1

Disable writeroom maximization effect

This commit is contained in:
Jessie Hildebrandt 2022-12-19 07:05:39 -05:00
parent 5440032d97
commit ed8eef8420

20
init.el
View File

@ -1312,31 +1312,15 @@ DOCSTRING is an optional form that is discarded upon expansion."
;; writeroom-mode ;; writeroom-mode
;; ---------------------------------- ;; ;; ---------------------------------- ;;
(defun user/writeroom-auto-disable (&rest _)
"Disable writeroom mode if the previous command hid the writeroom buffer."
(if writeroom--buffers
(let ((writeroom-buffer (car writeroom--buffers)))
(unless (or (active-minibuffer-window)
(get-buffer-window writeroom-buffer))
(with-current-buffer writeroom-buffer (writeroom-mode -1))
(remove-hook 'post-command-hook #'user/writeroom-auto-disable)))
(remove-hook 'post-command-hook #'user/writeroom-auto-disable)))
(external-package writeroom-mode (external-package writeroom-mode
"Maximizes the active window and centers the working text area" "Centers the working text area in the active buffer"
:custom :custom
(writeroom-width 140 "Set the working area width to 140 columns.") (writeroom-width 140 "Set the working area width to 140 columns.")
(writeroom-maximize-window t "Automatically maximize the active window.") (writeroom-maximize-window nil "Do not maximize the active window.")
(writeroom-mode-line t "Show the mode line while writeroom-mode is active.") (writeroom-mode-line t "Show the mode line while writeroom-mode is active.")
(writeroom-header-line t "Show the header line while writeroom-mode is active.") (writeroom-header-line t "Show the header line while writeroom-mode is active.")
(writeroom-global-effects nil "Disable all frame-wide writeroom effects.") (writeroom-global-effects nil "Disable all frame-wide writeroom effects.")
(writeroom-fringes-outside-margins nil "Keep the fringes close to the text.") (writeroom-fringes-outside-margins nil "Keep the fringes close to the text.")
(writeroom-restore-window-config t "Restore the previous window layout upon deactivation.")
:hook
(writeroom-mode-enable-hook . (lambda ()
(add-hook 'post-command-hook #'user/writeroom-auto-disable)))
(writeroom-mode-disable-hook . (lambda ()
(remove-hook 'post-command-hook #'user/writeroom-auto-disable)))
:bind :bind
(("C-c f" . writeroom-mode) (("C-c f" . writeroom-mode)
(:map writeroom-mode-map (:map writeroom-mode-map