Refactor nasty zen-mode customisations

I know better now
This commit is contained in:
TEC 2022-06-07 12:57:46 +08:00
parent 1118bf0e77
commit c990746b91
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 24 additions and 24 deletions

View File

@ -2689,6 +2689,28 @@ tweaks. Namely:
(setq +zen--original-mixed-pitch-mode-p mixed-pitch-mode)
(funcall (if +zen-serif-p #'mixed-pitch-serif-mode #'mixed-pitch-mode) 1))
(funcall #'mixed-pitch-mode (if +zen--original-mixed-pitch-mode-p 1 -1)))))
(defun +zen-prose-org-h ()
"Reformat the current Org buffer appearance for prose."
(when (eq major-mode 'org-mode)
(setq display-line-numbers nil
visual-fill-column-width 60
org-adapt-indentation nil)
(when (featurep 'org-modern)
(setq-local org-modern-star '("🙘" "🙙" "🙚" "🙛")
;; org-modern-star '("🙐" "🙑" "🙒" "🙓" "🙔" "🙕" "🙖" "🙗")
org-modern-hide-stars +zen-org-starhide)
(org-modern-mode -1)
(org-modern-mode 1))
(setq
+zen--original-org-indent-mode-p org-indent-mode)
(org-indent-mode -1)))
(defun +zen-nonprose-org-h ()
"Reverse the effect of `+zen-prose-org'."
(when (eq major-mode 'org-mode)
(when (bound-and-true-p org-modern-mode)
(org-modern-mode -1)
(org-modern-mode 1))
(when +zen--original-org-indent-mode-p (org-indent-mode 1))))
(pushnew! writeroom--local-variables
'display-line-numbers
'visual-fill-column-width
@ -2696,30 +2718,8 @@ tweaks. Namely:
'org-modern-mode
'org-modern-star
'org-modern-hide-stars)
(add-hook 'writeroom-mode-enable-hook
(defun +zen-prose-org-h ()
"Reformat the current Org buffer appearance for prose."
(when (eq major-mode 'org-mode)
(setq display-line-numbers nil
visual-fill-column-width 60
org-adapt-indentation nil)
(when (featurep 'org-modern)
(setq-local org-modern-star '("🙘" "🙙" "🙚" "🙛")
;; org-modern-star '("🙐" "🙑" "🙒" "🙓" "🙔" "🙕" "🙖" "🙗")
org-modern-hide-stars +zen-org-starhide)
(org-modern-mode -1)
(org-modern-mode 1))
(setq
+zen--original-org-indent-mode-p org-indent-mode
(org-indent-mode -1))))
(add-hook 'writeroom-mode-disable-hook
(defun +zen-nonprose-org-h ()
"Reverse the effect of `+zen-prose-org'."
(when (eq major-mode 'org-mode)
(when (bound-and-true-p org-modern-mode)
(org-modern-mode -1)
(org-modern-mode 1))
(when +zen--original-org-indent-mode-p (org-indent-mode 1)))))))
(add-hook 'writeroom-mode-enable-hook #'+zen-prose-org-h)
(add-hook 'writeroom-mode-disable-hook #'+zen-nonprose-org-h))
#+end_src
#+attr_html: :class invertible :alt Writeroom applied to an Org file