2019-12-20 00:44:58 -05:00
|
|
|
;;; ui/zen/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
(defvar +zen-mixed-pitch-modes '(markdown-mode org-mode)
|
|
|
|
"What major-modes to enable `mixed-pitch-mode' in with `writeroom-mode'.")
|
|
|
|
|
2020-01-02 21:54:28 -05:00
|
|
|
(defvar +zen-text-scale 1
|
|
|
|
"The text-scaling level for `writeroom-mode'.")
|
|
|
|
|
2019-12-20 00:44:58 -05:00
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Packages
|
|
|
|
|
|
|
|
(after! writeroom-mode
|
2020-01-09 02:45:41 -05:00
|
|
|
;; Users should be able to activate writeroom-mode in one buffer (e.g. an org
|
|
|
|
;; buffer) and code in another. Fullscreening/maximizing will be opt-in.
|
|
|
|
(setq writeroom-maximize-window nil)
|
|
|
|
(remove-hook 'writeroom-global-effects 'writeroom-set-fullscreen)
|
2019-12-20 00:44:58 -05:00
|
|
|
|
2020-01-02 21:54:28 -05:00
|
|
|
(add-hook! 'writeroom-mode-hook
|
2020-01-09 02:47:06 -05:00
|
|
|
(defun +zen-enable-text-scaling-mode-h ()
|
2020-01-02 21:54:28 -05:00
|
|
|
"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)))))
|
|
|
|
|
2019-12-20 00:44:58 -05:00
|
|
|
;; Adjust margins when text size is changed
|
|
|
|
(advice-add #'text-scale-adjust :after #'visual-fill-column-adjust))
|
|
|
|
|
|
|
|
|
|
|
|
(use-package! mixed-pitch
|
|
|
|
:hook (writeroom-mode . +zen-enable-mixed-pitch-mode-h)
|
|
|
|
: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))))
|
|
|
|
|
|
|
|
(pushnew! mixed-pitch-fixed-pitch-faces
|
|
|
|
'org-date
|
|
|
|
'org-special-keyword
|
|
|
|
'org-property-value
|
|
|
|
'org-ref-cite-face
|
|
|
|
'org-tag
|
|
|
|
'org-todo-keyword-todo
|
|
|
|
'org-todo-keyword-habt
|
|
|
|
'org-todo-keyword-done
|
|
|
|
'org-todo-keyword-wait
|
|
|
|
'org-todo-keyword-kill
|
|
|
|
'org-todo-keyword-outd
|
|
|
|
'org-todo
|
|
|
|
'org-indent
|
|
|
|
'font-lock-comment-face
|
|
|
|
'line-number
|
|
|
|
'line-number-current-line))
|