further theme back fix

This commit is contained in:
Yann Esposito (Yogsototh) 2021-11-08 16:58:07 +01:00
parent 9d5b5f6193
commit 3381cfb6ee
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -35,6 +35,7 @@
(require 'doom-themes) (require 'doom-themes)
(require 'hl-sentence) (require 'hl-sentence)
(defvar doom-theme) (defvar doom-theme)
(defvar custom-enabled-themes)
;;;###autoload ;;;###autoload
(when (and (boundp 'custom-theme-load-path) load-file-name ) (when (and (boundp 'custom-theme-load-path) load-file-name )
@ -67,16 +68,14 @@
nil nil
;; body ;; body
(if zen-writer-mode (if zen-writer-mode
(progn (zen-writer-on)
;; save theme before enabling ZenWriter
(setq zen-writer--pre-zen-doom-theme doom-theme)
(zen-writer-on))
(zen-writer-off))) (zen-writer-off)))
(defun zen-writer-select-user-theme () (defun zen-writer-select-user-theme ()
"Change the theme back to the theme prior to the Zen Writer theme." "Change the theme back to the theme prior to the Zen Writer theme."
(setq doom-theme zen-writer--pre-zen-doom-theme) (when zen-writer--pre-zen-doom-theme
(load-theme doom-theme t)) (setq doom-theme zen-writer--pre-zen-doom-theme)
(load-theme doom-theme t)))
(defun zen-writer-current-hour () (defun zen-writer-current-hour ()
"Retrieve current local hour." "Retrieve current local hour."
@ -98,12 +97,19 @@
(defun zen-writer-on () (defun zen-writer-on ()
"Activate Zen Writer." "Activate Zen Writer."
(when (not zen-writer--pre-zen-doom-theme)
;; save theme before enabling ZenWriter
(setq zen-writer--pre-zen-doom-theme
(or (when (and custom-enabled-themes (listp custom-enabled-themes))
(car custom-enabled-themes))
doom-theme)))
(zen-writer-select-theme) (zen-writer-select-theme)
(hl-sentence-mode +1)) (hl-sentence-mode +1))
(defun zen-writer-off () (defun zen-writer-off ()
"Deactivate Zen Writer." "Deactivate Zen Writer."
(zen-writer-select-user-theme) (zen-writer-select-user-theme)
(setq zen-writer--pre-zen-doom-theme nil)
(hl-sentence-mode -1)) (hl-sentence-mode -1))
;; Full Zen Writer ;; Full Zen Writer