diff options
-rw-r--r-- | lisp/acdw-reading.el | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/lisp/acdw-reading.el b/lisp/acdw-reading.el index 26ee5e8..e0a7f74 100644 --- a/lisp/acdw-reading.el +++ b/lisp/acdw-reading.el | |||
@@ -11,8 +11,17 @@ | |||
11 | ;; - Don't hurt yourself. | 11 | ;; - Don't hurt yourself. |
12 | ;; - Make good choices. | 12 | ;; - Make good choices. |
13 | 13 | ||
14 | ;;; Commentary: | ||
15 | |||
16 | ;; here is my attempt at a reading mode. | ||
17 | |||
14 | ;;; Code: | 18 | ;;; Code: |
15 | 19 | ||
20 | (require 'olivetti) | ||
21 | |||
22 | (defvar-local //indicate-empty-lines nil) | ||
23 | (defvar-local //indicate-buffer-boundaries nil) | ||
24 | |||
16 | ;;;###autoload | 25 | ;;;###autoload |
17 | (define-minor-mode reading-mode | 26 | (define-minor-mode reading-mode |
18 | "A mode for reading." | 27 | "A mode for reading." |
@@ -22,30 +31,37 @@ | |||
22 | (if reading-mode | 31 | (if reading-mode |
23 | (progn ;; turn on | 32 | (progn ;; turn on |
24 | ;; settings | 33 | ;; settings |
25 | (setq-local orig-indicate-empty-lines indicate-empty-lines | 34 | (setq-local //indicate-empty-lines indicate-empty-lines |
26 | indicate-empty-lines nil | 35 | indicate-empty-lines nil |
27 | orig-indicate-buffer-boundaries indicate-buffer-boundaries | 36 | //indicate-buffer-boundaries indicate-buffer-boundaries |
28 | indicate-buffer-boundaries nil) | 37 | indicate-buffer-boundaries nil) |
29 | ;; disable modes | 38 | ;; disable modes |
30 | (dolist (mode '(display-fill-column-indicator-mode)) | 39 | (dolist (mode '(display-fill-column-indicator-mode |
40 | blink-cursor-mode)) | ||
31 | (when (fboundp mode) | 41 | (when (fboundp mode) |
42 | (set (make-local-variable | ||
43 | (intern (format "//%s" mode))) | ||
44 | (symbol-value mode)) | ||
32 | (funcall mode -1))) | 45 | (funcall mode -1))) |
33 | ;; enable modes | 46 | ;; enable modes |
34 | (dolist (mode '(olivetti-mode)) | 47 | (dolist (mode '(olivetti-mode)) |
35 | (when (fboundp mode) | 48 | (when (fboundp mode) |
49 | (set (make-local-variable | ||
50 | (intern (format "//%s" mode))) | ||
51 | (symbol-value mode)) | ||
36 | (funcall mode +1)))) | 52 | (funcall mode +1)))) |
37 | ;; turn off | 53 | ;; turn off |
38 | ;; settings | 54 | ;; restore settings |
39 | (setq-local indicate-empty-lines orig-indicate-empty-lines | 55 | (setq-local indicate-empty-lines //indicate-empty-lines |
40 | indicate-buffer-boundaries orig-indicate-buffer-boundaries) | 56 | indicate-buffer-boundaries //indicate-buffer-boundaries) |
41 | ;; enable modes | 57 | ;; restore modes |
42 | (dolist (mode '(display-fill-column-indicator-mode)) | 58 | (dolist (mode '(display-fill-column-indicator-mode |
43 | (when (fboundp mode) | 59 | olivetti-mode |
44 | (funcall mode +1))) | 60 | blink-cursor-mode)) |
45 | ;; disable modes | ||
46 | (dolist (mode '(olivetti-mode)) | ||
47 | (when (fboundp mode) | 61 | (when (fboundp mode) |
48 | (funcall mode -1))))) | 62 | (funcall mode (if (symbol-value (intern (format "//%s" mode))) |
63 | +1 | ||
64 | -1)))))) | ||
49 | 65 | ||
50 | (provide 'acdw-reading) | 66 | (provide 'acdw-reading) |
51 | ;;; acdw-reading.el ends here | 67 | ;;; acdw-reading.el ends here |