commit c55a31050895f5bdbb45293657b6c246f49447eb
parent 5c03c021ccf2df655ee973e500cb8f4b518cc5b4
Author: Alex Balgavy <alex@balgavy.eu>
Date: Wed, 30 Jun 2021 19:20:30 +0200
emacs: add vterm, add elisp fanciness
Built in term emulators suck for running programs like newsboat and
neomutt, so I add vterm. Also, I added some fancy elisp stuff to make
the config a bit easier to understand and change later.
Diffstat:
2 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/emacs/config.org b/emacs/config.org
@@ -29,12 +29,23 @@
(doom-themes-org-config))
#+end_src
- Change theme depending on the current system theme (I use the presence of the ~/.config/dark-theme file to indicate when dark theme is set):
+ Define the themes I want:
+
+ #+begin_src elisp
+ (setq dark-theme 'doom-one)
+ (setq light-theme 'doom-acario-light)
+ #+end_src
+
+ Change theme depending on the current system theme.
+ The way I check for dark mode is defined in 'dark-mode-p'; currently I use the presence of the ~/.config/dark-theme file to indicate when dark theme is set.
+ A function ending in '-p' is a predicate, i.e. returns true or false.
#+begin_src emacs-lisp
- (if (file-exists-p "~/.config/dark-theme")
- (load-theme 'doom-one t)
- (load-theme 'doom-acario-light t))
+ (let ((dark-mode-p (lambda () (file-exists-p "~/.config/dark-theme"))))
+
+ (if (dark-mode-p)
+ (load-theme dark-theme t)
+ (load-theme light-theme t)))
#+end_src
* Garbage collection
@@ -164,6 +175,15 @@
(use-package magit)
#+end_src
+** vterm
+ Emacs has a bunch of built-in terminal emulators.
+ And they all suck.
+ (OK not really, eshell is good, but not for interactive terminal programs like newsboat/neomutt)
+
+ #+begin_src emacs-lisp
+ (use-package vterm)
+ #+end_src
+
* Interface
** GUI elements
Get rid of all bars.
@@ -201,10 +221,16 @@
(global-display-line-numbers-mode)
#+end_src
- Don't display them in specific modes:
+ Don't display them in specific modes. For each of the modes in
+ 'mode-hooks', add a function to hide line numbers when the mode
+ activates (which triggers the 'mode'-hook).
#+begin_src emacs-lisp
- (add-hook 'doc-view-mode-hook (lambda () (display-line-numbers-mode 0)))
+ (let ((mode-hooks '(doc-view-mode-hook vterm-mode-hook)))
+ (mapc
+ (lambda (mode-name)
+ (add-hook mode-name (lambda () (display-line-numbers-mode 0))))
+ mode-hooks))
#+end_src
* Auto-Save files
diff --git a/emacs/init.el b/emacs/init.el
@@ -10,9 +10,9 @@
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
- '("f2927d7d87e8207fa9a0a003c0f222d45c948845de162c885bf6ad2a255babfd" "e3c64e88fec56f86b49dcdc5a831e96782baf14b09397d4057156b17062a8848" "f4876796ef5ee9c82b125a096a590c9891cec31320569fc6ff602ff99ed73dca" default))
+ '("8f5a7a9a3c510ef9cbb88e600c0b4c53cdcdb502cfe3eb50040b7e13c6f4e78e" "4bca89c1004e24981c840d3a32755bf859a6910c65b829d9441814000cf6c3d0" "f2927d7d87e8207fa9a0a003c0f222d45c948845de162c885bf6ad2a255babfd" "e3c64e88fec56f86b49dcdc5a831e96782baf14b09397d4057156b17062a8848" "f4876796ef5ee9c82b125a096a590c9891cec31320569fc6ff602ff99ed73dca" default))
'(package-selected-packages
- '(magit lean-mode markdown-mode anki-connect anki-editor doom-themes all-the-icons use-package-ensure which-key use-package org-bullets helm exec-path-from-shell)))
+ '(vterm notmuch magit lean-mode markdown-mode anki-connect anki-editor doom-themes all-the-icons use-package-ensure which-key use-package org-bullets helm exec-path-from-shell)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.