Commit Diff


commit - e8a1f1cb0f4a924799689f1e0f8e3e2c4c5543e7
commit + ef2b07cffcac374241676aff08dd67e4e6878daf
blob - 97eb77ae045b4da97351ad53658ae6443fe833f7
blob + c44d086abf551420253d123735095e0857effdf6
--- lisp/setup-core.el
+++ lisp/setup-core.el
@@ -7,6 +7,7 @@
 ;;; Code:
 
 (require 'subr-x)  ; string-remove-prefix
+(require 'savehist)
 
 (declare-function undo-fu-session-global-mode "undo-fu-session" (&optional arg))
 
@@ -77,6 +78,11 @@ mirrored path as relative; its parent directories are 
         url-configuration-directory (mine-cache-subdir "url")
         eshell-directory-name (mine-cache-subdir "eshell"))
 
+(defvar mine-last-ef-theme nil
+  "Persist selected theme after restart.")
+
+(add-to-list 'savehist-additional-variables 'mine-last-ef-theme)
+
 (savehist-mode 1)
 (recentf-mode 1)
 
blob - 9dae534649a5be7734fd30e6b2bc3fb01f1b1685
blob + 086fd7d9668cd65c9a1a81ca15318e30c3c10a26
--- lisp/setup-ui.el
+++ lisp/setup-ui.el
@@ -77,6 +77,15 @@
   ;; Move underlines to the descent line to reduce glyph clipping.
   (setopt x-underline-at-descent-line t))
 
+(defun mine-ef-theme--record ()
+  "Persist selected theme on restart."
+  (when (display-graphic-p)
+    (catch 'found
+      (dolist (theme custom-enabled-themes)
+        (when (memq theme ef-themes-items)
+          (setq mine-last-ef-theme theme)
+          (throw 'found t))))))
+
 (use-package modus-themes
   :unless (display-graphic-p)
   :demand t
@@ -87,7 +96,8 @@
   :if (display-graphic-p)
   :demand t
   :config
-  (load-theme 'ef-winter t))
+  (add-hook 'ef-themes-after-load-theme-hook #'mine-ef-theme--record)
+  (load-theme (or mine-last-ef-theme 'ef-winter) t))
 
 (setopt display-line-numbers-width 3)