making emacs work better under nixos

This commit is contained in:
Chris Cochrun 2022-05-08 06:24:57 -05:00
parent bf57945a82
commit c25d060033
4 changed files with 62 additions and 191 deletions

View file

@ -6,6 +6,7 @@
- [[#startup-performance][Startup Performance]]
- [[#set-basic-ui-config][Set basic UI config]]
- [[#lets-bootstrap-straightel][Let's bootstrap straight.el]]
- [[#fix-nixos][Fix NixOS]]
- [[#keep-folders-clean][Keep Folders Clean]]
- [[#ligatures][Ligatures]]
- [[#keybindings][Keybindings]]
@ -73,9 +74,6 @@ Let's also set the =gc-cons-threshold= variable to a high setting for the remain
(setq gc-cons-threshold 50000000)
#+end_src
#+RESULTS:
: 50000000
** Set basic UI config
Let's start by making some basic ui changes like turning off the scrollbar, toolbar, menu, tooltips, and setting our font and some things.
#+begin_src emacs-lisp
@ -94,8 +92,6 @@ Let's start by making some basic ui changes like turning off the scrollbar, tool
(setq comp-deferred-compilation-deny-list nil)
#+end_src
#+RESULTS:
In order to have this config work on both my desktop with regular joe-schmoe monitors and my laptop with new-hotness HiDPI monitor, I will set the font size if my system is the laptop to much higher.
#+begin_src emacs-lisp
(if (string-equal (system-name) "syl")
@ -115,18 +111,18 @@ In order to have this config work on both my desktop with regular joe-schmoe mon
(defun chris/set-transparency ()
"Set the frame to be transparent on Wayland compositors"
(if (string-search "wayland" x-display-name)
'((set-frame-parameter (selected-frame) 'alpha '(100 . 100))
(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(alpha . (100 . 100))))))
(set-frame-parameter (selected-frame) 'alpha '(100 . 100))
(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(alpha . (100 . 100))))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(chris/set-font-faces)))
(chris/set-font-faces)
(chris/set-transparency)
(tool-bar-mode -1)))
(chris/set-font-faces)))
#+end_src
Then let's make sure line-numbers are relative and on. And let's turn on visual-line-mode globally.
@ -287,11 +283,7 @@ Let's make parens and other delimiters easier to tell apart by making nested one
(use-package aggressive-indent
:defer 1
:config
<<<<<<< HEAD
(aggressive-indent-mode -1))
=======
)
>>>>>>> 2338cd74 (adding temel stuff)
#+end_src
#+begin_src emacs-lisp
@ -307,6 +299,19 @@ Let's make parens and other delimiters easier to tell apart by making nested one
:defer 1)
#+end_src
** Fix NixOS
I am currently using NixOS. In order for emacs to have access to certain programs, we need to set some environment variables
#+begin_src emacs-lisp
(add-to-list 'exec-path "/home/chris/.nix-profile/bin")
(add-to-list 'exec-path "/run/current-system/sw/bin")
(setenv "NIX_CONF_DIR" "/etc/nix")
(setenv "NIX_OTHER_STORES" "/run/nix/remote-stores/*/nix")
(setenv "NIX_PATH" "nixpkgs=%h/nixpkgs:nixos=%h/nixpkgs/nixos:nixos-config=/etc/nixos/configuration.nix")
(setenv "NIX_PROFILES" "${pkgs.lib.concatStringsSep " " config.environment.profiles}")
(setenv "NIX_REMOTE" "daemon")
(setenv "NIX_USER_PROFILE_DIR" "/nix/var/nix/profiles/per-user/%u")
#+end_src
** Keep Folders Clean
Let's use =no-littering= in order to stop emacs from filling all our folders with junk.
@ -539,8 +544,7 @@ Part of this config includes some special capture templates for my work as a you
'((emacs-lisp . t)
(python . t)
(ditaa . t)
(shell . t)
(restclient . t)))
(shell . t)))
(setq org-ditaa-jar-path "/usr/bin/ditaa")
@ -858,6 +862,7 @@ Org-Superstar makes the stars at the beginning of the line in =org-mode= a lot p
(custom-set-faces
'(org-modern-tag ((t :background "#9aedfe" :foreground "#282a36")))
)
(global-org-modern-mode +1)
)
#+END_SRC
@ -1540,7 +1545,7 @@ Trying out corfu instead of company
;; Recommended: Enable Corfu globally.
;; This is recommended since dabbrev can be used globally (M-/).
:init
(corfu-global-mode)
(global-corfu-mode)
:general
('corfu-map
"C-j" 'corfu-next
@ -1833,6 +1838,13 @@ Let's also set =hl-line-mode= to be on for comint and prog modes
(add-hook 'prog-mode-hook 'hs-minor-mode)
#+END_SRC
*** Tree Sitter
I'm gonna try this to speed up emacs and make it nicer
#+begin_src emacs-lisp :tangle no
(use-package tree-sitter)
(use-package tree-sitter-langs)
#+end_src
*** C++
In c++ I just want to make sure lsp is called when enter c++-mode
#+BEGIN_SRC emacs-lisp
@ -1846,6 +1858,13 @@ Since I use the Awesome WM I thought it'd be good to have lua around. It's also
:mode ("\\.lua\\'" . lua-mode))
#+end_src
*** Nix
I've been transitioning more of my OS to NixOS. Let's get =nix-mode= working.
#+begin_src emacs-lisp
(use-package nix-mode
:mode "\\.nix\\'")
#+end_src
*** LSP
LSP is useful...
#+begin_src emacs-lisp
@ -2164,7 +2183,7 @@ Ledger mode
#+end_src
** MU4E
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no
(use-package mu4e
:ensure nil
:config
@ -2323,7 +2342,6 @@ Ledger mode
(general-def 'normal mu4e-view-mode-map
"ga" 'mu4e-view-save-attachments))
#+end_src
# (use-package org-mime