diff options
Diffstat (limited to 'lisp/acdw-reading.el')
-rw-r--r-- | lisp/acdw-reading.el | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lisp/acdw-reading.el b/lisp/acdw-reading.el new file mode 100644 index 0000000..e21cff9 --- /dev/null +++ b/lisp/acdw-reading.el | |||
@@ -0,0 +1,51 @@ | |||
1 | ;;; acdw-reading.el --- minor mode for reading -*- lexical-binding: t -*- | ||
2 | |||
3 | ;; Copyright 2021 Case Duckworth <acdw@acdw.net> | ||
4 | ;; This file is NOT part of GNU Emacs. | ||
5 | |||
6 | ;;; License: | ||
7 | |||
8 | ;; Everyone is permitted to do whatever with this software, without | ||
9 | ;; limitation. This software comes without any warranty whatsoever, | ||
10 | ;; but with two pieces of advice: | ||
11 | ;; - Don't hurt yourself. | ||
12 | ;; - Make good choices. | ||
13 | |||
14 | ;;; Code: | ||
15 | |||
16 | ;;;###autoload | ||
17 | (define-minor-mode reading-mode | ||
18 | "A mode for reading." | ||
19 | :init-value nil | ||
20 | :lighter " Read" | ||
21 | :keymap (make-sparse-keymap) | ||
22 | (if reading-mode | ||
23 | (progn ;; turn on | ||
24 | ;; settings | ||
25 | (setq-local orig-indicate-empty-lines indicate-empty-lines | ||
26 | indicate-empty-lines nil | ||
27 | orig-indicate-buffer-boundaries indicate-buffer-boundaries | ||
28 | indicate-buffer-boundaries nil) | ||
29 | ;; disable modes | ||
30 | (dolist (mode '(display-fill-column-indicator-mode)) | ||
31 | (when (fboundp mode) | ||
32 | (funcall mode -1))) | ||
33 | ;; enable modes | ||
34 | (dolist (mode '(olivetti-mode)) | ||
35 | (when (fboundp mode) | ||
36 | (funcall mode +1)))) | ||
37 | ;; turn off | ||
38 | ;; settings | ||
39 | (setq-local indicate-empty-lines orig-indicate-empty-lines | ||
40 | indicate-buffer-boundaries orig-indicate-buffer-boundaries) | ||
41 | ;; enable modes | ||
42 | (dolist (mode '(display-fill-column-indicator-mode)) | ||
43 | (when (fboundp mode) | ||
44 | (funcall mode +1))) | ||
45 | ;; disable modes | ||
46 | (dolist (mode '(olivetti-mode)) | ||
47 | (when (fboundp mode) | ||
48 | (funcall mode -1))))) | ||
49 | |||
50 | (provide 'acdw-reading) | ||
51 | ;;; acdw-reading.el ends here | ||