summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-03-31 12:45:42 -0500
committerCase Duckworth2021-03-31 12:45:42 -0500
commitd503a2d1b63d21a63a067af254de0d24257f2641 (patch)
treebfc059555136fef1e877d85784e93f9a8bef063d
parentFix font setting (diff)
downloademacs-d503a2d1b63d21a63a067af254de0d24257f2641.tar.gz
emacs-d503a2d1b63d21a63a067af254de0d24257f2641.zip
Add `olivetti' and tweak `acdw/reading-mode'
-rw-r--r--init.el9
-rw-r--r--lisp/acdw.el36
2 files changed, 39 insertions, 6 deletions
diff --git a/init.el b/init.el index 8c60cda..1ba61dc 100644 --- a/init.el +++ b/init.el
@@ -302,6 +302,9 @@
302 shr-image-animate t 302 shr-image-animate t
303 shr-discard-aria-hidden t)) 303 shr-discard-aria-hidden t))
304 304
305(setup eww
306 (:hook acdw/reading-mode))
307
305(add-hook 'text-mode-hook #'goto-address-mode) 308(add-hook 'text-mode-hook #'goto-address-mode)
306(add-hook 'prog-mode-hook #'goto-address-prog-mode) 309(add-hook 'prog-mode-hook #'goto-address-prog-mode)
307 310
@@ -479,6 +482,12 @@
479 (require 'acdw-modeline) 482 (require 'acdw-modeline)
480 (simple-modeline-mode +1)) 483 (simple-modeline-mode +1))
481 484
485;;;; Olivetti
486;; also useful for `acdw/reading-mode'
487(setup (:straight olivetti)
488 (:option olivetti-body-width (+ fill-column 4)
489 olivetti-minimum-body-width fill-column))
490
482;;; Utilities 491;;; Utilities
483 492
484;;;; 0x0 -- upload files to a nullpointer 493;;;; 0x0 -- upload files to a nullpointer
diff --git a/lisp/acdw.el b/lisp/acdw.el index 35d5ac1..e1d4b48 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -99,17 +99,41 @@ directory."
99 :lighter " Read" 99 :lighter " Read"
100 (if acdw/reading-mode 100 (if acdw/reading-mode
101 (progn ;; turn on 101 (progn ;; turn on
102 (display-fill-column-indicator-mode -1) 102 ;; settings
103 (dolist (mode '(visual-fill-column-mode 103 (setq-local mode-line-format
104 iscroll-mode)) 104 '(:eval
105 (let* ((fmt " Reading %b (%m) ")
106 (len (length (format-mode-line fmt))))
107 (concat
108 (propertize " "
109 'display `((space :align-to (- right
110 ,len)))
111 'face '(:inherit italic))
112 fmt))))
113 ;; modes to disable
114 (dolist (mode '(display-fill-column-indicator-mode
115 simple-modeline-mode))
116 (when (fboundp mode)
117 (funcall mode -1)))
118 ;; modes to enable
119 (dolist (mode '(iscroll-mode
120 olivetti-mode))
105 (when (fboundp mode) 121 (when (fboundp mode)
106 (funcall mode +1)))) 122 (funcall mode +1))))
107 ;; turn off 123 ;; turn off
108 (display-fill-column-indicator-mode +1) 124 ;; settings
109 (dolist (mode '(visual-fill-column-mode 125 (kill-local-variable 'mode-line-format)
126 ;; modes to re-enable
127 (dolist (mode '(display-fill-column-indicator-mode
128 simple-modeline-mode))
129 (when (fboundp mode)
130 (funcall mode +1)))
131 ;; modes to re-disable
132 (dolist (mode '(olivetti-mode
110 iscroll-mode)) 133 iscroll-mode))
111 (when (fboundp mode) 134 (when (fboundp mode)
112 (funcall mode -1))))) 135 (funcall mode -1)))
136 (force-mode-line-update)))
113 137
114;;; Keymap & Mode 138;;; Keymap & Mode
115 139