diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw-reading.el | 51 | ||||
-rw-r--r-- | lisp/acdw.el | 41 |
2 files changed, 51 insertions, 41 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 | ||
diff --git a/lisp/acdw.el b/lisp/acdw.el index 0039de2..5bb53e2 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -535,47 +535,6 @@ It's called 'require-private' for historical reasons." | |||
535 | recentf-list))) | 535 | recentf-list))) |
536 | 536 | ||
537 | 537 | ||
538 | ;;; Minor modes | ||
539 | |||
540 | (define-minor-mode acdw/reading-mode | ||
541 | "A mode for reading." | ||
542 | :init-value nil | ||
543 | :lighter " Read" | ||
544 | :keymap (let ((map (make-sparse-keymap))) | ||
545 | (when-let ((link-cmd (or (fbound-and-true-p #'ace-link) | ||
546 | (fbound-and-true-p #'link-hint-open-link)))) | ||
547 | (define-key map (kbd ";") link-cmd) | ||
548 | (define-key map (kbd "o") link-cmd)) | ||
549 | map) | ||
550 | (if acdw/reading-mode | ||
551 | (progn ;; turn on | ||
552 | ;; settings | ||
553 | (setq-local orig-indicate-empty-lines indicate-empty-lines | ||
554 | indicate-empty-lines nil | ||
555 | orig-indicate-buffer-boundaries indicate-buffer-boundaries | ||
556 | indicate-buffer-boundaries nil) | ||
557 | ;; disable modes | ||
558 | (dolist (mode '(display-fill-column-indicator-mode)) | ||
559 | (when (fboundp mode) | ||
560 | (funcall mode -1))) | ||
561 | ;; enable modes | ||
562 | (dolist (mode '(olivetti-mode)) | ||
563 | (when (fboundp mode) | ||
564 | (funcall mode +1)))) | ||
565 | ;; turn off | ||
566 | ;; settings | ||
567 | (setq-local indicate-empty-lines orig-indicate-empty-lines | ||
568 | indicate-buffer-boundaries orig-indicate-buffer-boundaries) | ||
569 | ;; enable modes | ||
570 | (dolist (mode '(display-fill-column-indicator-mode)) | ||
571 | (when (fboundp mode) | ||
572 | (funcall mode +1))) | ||
573 | ;; disable modes | ||
574 | (dolist (mode '(olivetti-mode)) | ||
575 | (when (fboundp mode) | ||
576 | (funcall mode -1))))) | ||
577 | |||
578 | |||
579 | ;;; Sort setq... | 538 | ;;; Sort setq... |
580 | ;; https://emacs.stackexchange.com/questions/33039/ | 539 | ;; https://emacs.stackexchange.com/questions/33039/ |
581 | 540 | ||