dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 07f248ab0150657f46d852bf0fe79869fc525c1a
parent 75e1037038670f6723a2d237c432afaa8e8adb5e
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Tue, 30 Nov 2021 19:20:36 +0100

emacs: lots of small config changes

Diffstat:
Memacs/config.org | 38+++++++++++++++++++++-----------------
Memacs/custom.el | 5++---
Memacs/init.el | 30+++++++++++++++++++++++-------
3 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/emacs/config.org b/emacs/config.org @@ -1,6 +1,4 @@ * Theme -I want this to load first because otherwise it'll blind me during the night while it's trying to refresh packages. - Icons required for some parts of the doom theme: #+begin_src emacs-lisp @@ -19,12 +17,6 @@ Load Doom Emacs themes: ;; Enable flashing mode-line on errors (doom-themes-visual-bell-config) - ;; Enable custom neotree theme (all-the-icons must be installed!) - (doom-themes-neotree-config) - ;; or for treemacs users - (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme - (doom-themes-treemacs-config) - ;; Corrects (and improves) org-mode's native fontification. (doom-themes-org-config)) #+end_src @@ -32,21 +24,20 @@ Load Doom Emacs themes: Define the themes I want: #+begin_src emacs-lisp - (setq dark-theme 'doom-one) - ;; (setq light-theme 'doom-acario-light) + (setq dark-theme-name 'doom-one) + (setq light-theme-name 'jokull) ;; I used to use doom-acario-light before writing my own theme - (setq light-theme 'jokull) (defun dark-theme () "Switch to dark theme" (interactive) - (load-theme dark-theme t) + (load-theme dark-theme-name t) (add-hook 'pdf-view-mode-hook #'pdf-view-midnight-minor-mode)) (defun light-theme () "Switch to light theme" (interactive) - (load-theme light-theme t) + (load-theme light-theme-name t) (remove-hook 'pdf-view-mode-hook #'pdf-view-midnight-minor-mode)) #+end_src @@ -54,10 +45,11 @@ 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. If calling a function that's in a variable, you have to use 'funcall'. +To evaluate a quoted form, use 'eval'. #+begin_src emacs-lisp - (let ((dark-mode-p (lambda () (file-exists-p "~/.config/dark-theme")))) - (if (funcall dark-mode-p) + (let ((dark-mode-p '(file-exists-p "~/.config/dark-theme"))) + (if (eval dark-mode-p) (dark-theme) (light-theme))) #+end_src @@ -308,6 +300,8 @@ A better replacement for DocView: #+begin_src emacs-lisp (use-package pdf-tools :hook + (pdf-annot-list-mode . pdf-annot-list-follow-minor-mode) + (pdf-annot-edit-contents-minor-mode . org-mode) (pdf-view-mode . (lambda () (display-line-numbers-mode 0))) (pdf-view-mode . (lambda () (define-key pdf-isearch-minor-mode-map (kbd "C-s") #'isearch-forward)))) (pdf-tools-install) @@ -324,6 +318,16 @@ Like virtualenvwrapper.sh, but for Emacs. (setq venv-location "~/.config/virtualenvs")) #+end_src +** org-ref +#+begin_src emacs-lisp + (use-package org-ref) +#+end_src + +** org-noter +#+begin_src emacs-lisp + (use-package org-noter) +#+end_src + * Interface ** Messages Hide some messages I don't need. @@ -485,7 +489,7 @@ First one tells Emacs where to save customizations. The second one actually loads them. #+begin_src emacs-lisp - (setq custom-file (expand-file-name "~/.emacs.d/custom.el")) + (setq custom-file (expand-file-name (concat user-emacs-directory "custom.el"))) (load custom-file) #+end_src @@ -810,7 +814,7 @@ Run notmuch-hook script on hello refresh, to move messages to folders according Set the windows I want to show: #+begin_src emacs-lisp - (setq mpc-browser-tags '(Artist Album Genre Playlist)) + (setq mpc-browser-tags '(AlbumArtist Album Genre Playlist)) #+end_src Define some keybindings: diff --git a/emacs/custom.el b/emacs/custom.el @@ -6,7 +6,7 @@ '(ansi-color-names-vector ["#282c34" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"]) '(custom-safe-themes - '("835868dcd17131ba8b9619d14c67c127aa18b90a82438c8613586331129dda63" "fc38df02f7c48603f9c392c73f1810011a04b2e1fce8f085d7e15f2b35138863" "45e9823d714d1f28f6d53f79e1981b403ae905acbd027e6fcd5f3414a78a2341" "f91395598d4cb3e2ae6a2db8527ceb83fed79dbaf007f435de3e91e5bda485fb" "6c386d159853b0ee6695b45e64f598ed45bd67c47f671f69100817d7db64724d" "8f5a7a9a3c510ef9cbb88e600c0b4c53cdcdb502cfe3eb50040b7e13c6f4e78e" "4bca89c1004e24981c840d3a32755bf859a6910c65b829d9441814000cf6c3d0" "f2927d7d87e8207fa9a0a003c0f222d45c948845de162c885bf6ad2a255babfd" "e3c64e88fec56f86b49dcdc5a831e96782baf14b09397d4057156b17062a8848" "f4876796ef5ee9c82b125a096a590c9891cec31320569fc6ff602ff99ed73dca" default)) + '("dd9f9450d2761f2f50227469079a4e7c70692cf19d48fa82181925f706a5d391" "679a1db78d150d2e26768f756570999fc6f05649f1dabd83e6d43cc5b619579f" "0d01e1e300fcafa34ba35d5cf0a21b3b23bc4053d388e352ae6a901994597ab1" "835868dcd17131ba8b9619d14c67c127aa18b90a82438c8613586331129dda63" "fc38df02f7c48603f9c392c73f1810011a04b2e1fce8f085d7e15f2b35138863" "45e9823d714d1f28f6d53f79e1981b403ae905acbd027e6fcd5f3414a78a2341" "f91395598d4cb3e2ae6a2db8527ceb83fed79dbaf007f435de3e91e5bda485fb" "6c386d159853b0ee6695b45e64f598ed45bd67c47f671f69100817d7db64724d" "8f5a7a9a3c510ef9cbb88e600c0b4c53cdcdb502cfe3eb50040b7e13c6f4e78e" "4bca89c1004e24981c840d3a32755bf859a6910c65b829d9441814000cf6c3d0" "f2927d7d87e8207fa9a0a003c0f222d45c948845de162c885bf6ad2a255babfd" "e3c64e88fec56f86b49dcdc5a831e96782baf14b09397d4057156b17062a8848" "f4876796ef5ee9c82b125a096a590c9891cec31320569fc6ff602ff99ed73dca" default)) '(default-input-method "czech-qwerty") '(exwm-floating-border-color "#191b20") '(fci-rule-color "#5B6268") @@ -21,7 +21,7 @@ '(objed-cursor-color "#ff6c6b") '(package-hidden-regexps '("^I")) '(package-selected-packages - '(virtualenvwrapper elpy pdf-tools diminish company-lean counsel rainbow-mode edit-indirect expand-region elpher sr-speedbar 2048-game 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 exec-path-from-shell)) + '(org-noter org-ref virtualenvwrapper elpy pdf-tools diminish company-lean counsel rainbow-mode edit-indirect expand-region elpher sr-speedbar 2048-game 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 exec-path-from-shell)) '(pdf-view-midnight-colors (cons "#bbc2cf" "#282c34")) '(rustic-ansi-faces ["#282c34" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"]) @@ -52,7 +52,6 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(header-line ((t (:background "gray87")))) '(helm-buffer-file ((t (:inherit default)))) '(helm-ff-file-extension ((t (:inherit default)))) '(helm-non-file-buffer ((t (:inherit font-lock-comment-face)))) diff --git a/emacs/init.el b/emacs/init.el @@ -1,6 +1,7 @@ ;; Initial bootstrap -;; Follow symlinks without prompting (the org file is a symlink) -(setq vc-follow-symlinks t) +;; Start in fullscreen mode +(message (concat "Starting: " (emacs-uptime))) +(toggle-frame-fullscreen) ;; Get rid of all bars (setq org-src-tab-acts-natively t) @@ -14,6 +15,12 @@ (when (string-equal system-type "darwin") (setq package-check-signature nil)) +;; Also some problems connecting to package repos on Mac & a specific version +;; https://emacs.stackexchange.com/questions/68288/error-retrieving-https-elpa-gnu-org-packages-archive-contents +(when (and (equal emacs-version "27.2") + (eql system-type 'darwin)) + (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) + ;; Install and load use-package (unless (package-installed-p 'use-package) (package-refresh-contents t) @@ -24,9 +31,18 @@ (require 'use-package-ensure) (setq use-package-always-ensure t) -;; Start in fullscreen mode -(toggle-frame-fullscreen) +;; Follow symlinks without prompting (the org file is a symlink) +(setq vc-follow-symlinks t) + +;; Load all other customization from the org file, only compile if necessary +(let* ((.org (file-truename (concat user-emacs-directory "config.org"))) ; the .org file will be in VC + (.el (concat user-emacs-directory "config.el")) ; config.el is generated, so won't be in VC + (.org-modification-time (file-attribute-modification-time (file-attributes .org))) + (.el-modification-time (file-attribute-modification-time (file-attributes .el))) + (config-unchanged-p (time-less-p .org-modification-time .el-modification-time))) -;; Load all other customization from the org file -(org-babel-load-file - (expand-file-name "config.org" user-emacs-directory)) + (require 'org-macs) + (unless config-unchanged-p + (require 'ob-tangle) + (org-babel-tangle-file .org .el "emacs-lisp")) + (load-file .el))