fix(zen): focus-mode not deactivating with writeroom

By using `writeroom-local-effects` instead of
`writeroom-mode-hook` (which doesn't necessarily trigger on
deactivation).

Fix: doomemacs/community#68
This commit is contained in:
Henrik Lissner 2026-03-25 00:33:37 -04:00
parent ba511fcbfb
commit 9c3b5cbda3
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -29,11 +29,11 @@
(setq writeroom-global-effects nil)
(setq writeroom-maximize-window nil)
(add-hook! 'writeroom-mode-hook :append
(defun +zen-enable-text-scaling-mode-h ()
(add-hook! 'writeroom-local-effects :append
(defun +zen-enable-text-scaling-mode-h (arg)
"Enable `mixed-pitch-mode' when in `+zen-mixed-pitch-modes'."
(when (/= +zen-text-scale 0)
(text-scale-set (if writeroom-mode +zen-text-scale 0))
(text-scale-set (if (= arg 1) +zen-text-scale 0))
(visual-fill-column-adjust))))
;; Adjust margins when text size is changed
@ -41,13 +41,14 @@
(use-package! mixed-pitch
:hook (writeroom-mode . +zen-enable-mixed-pitch-mode-h)
:defer t
:init
(add-hook! 'writeroom-local-effects
(defun +zen-enable-mixed-pitch-mode-h (arg)
"Enable `mixed-pitch-mode' when in `+zen-mixed-pitch-modes'."
(if (apply #'derived-mode-p +zen-mixed-pitch-modes)
(mixed-pitch-mode arg))))
:config
(defun +zen-enable-mixed-pitch-mode-h ()
"Enable `mixed-pitch-mode' when in `+zen-mixed-pitch-modes'."
(when (apply #'derived-mode-p +zen-mixed-pitch-modes)
(mixed-pitch-mode (if writeroom-mode +1 -1))))
(dolist (face '(solaire-line-number-face
org-date
org-footnote
@ -69,7 +70,9 @@
(use-package! focus
:when (modulep! +focus)
:hook (writeroom-mode . focus-mode))
:defer t
:init
(add-hook 'writeroom-local-effects #'focus-mode t))
(use-package! lsp-focus