Save the theme as soon as you pick it, so new emacs pick it up

This commit is contained in:
Joseph Ferano 2023-02-16 10:50:09 +07:00
parent d4a756116a
commit 14e4b3d1fe

View File

@ -222,12 +222,17 @@ our case is worse since we have a literate file. Send all custom variables to ~c
(load custom-file)
#+end_src
Save the last used theme when exiting emacs and then reload it.
Save the chosen theme after picking a new one
#+begin_src emacs-lisp tangle: no
(defun joe/save-current-theme ()
(customize-save-variable 'custom-enabled-themes custom-enabled-themes))
(add-hook 'kill-emacs-hook #'joe/save-current-theme)
(defun joe/save-current-theme (THEME)
(let ((inhibit-message t)
(message-log-max nil))
(customize-save-variable 'custom-enabled-themes custom-enabled-themes)))
;; (add-hook 'kill-emacs-hook #'joe/save-current-theme)
(advice-add 'consult-theme :after #'joe/save-current-theme)
(advice-remove 'load-theme 'joe/save-current-theme)
#+end_src
*** Other