diff options
author | Case Duckworth | 2021-09-07 08:10:09 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-07 08:10:09 -0500 |
commit | 5b7fbf4bc65268533e16bde4ad6198537b85ee41 (patch) | |
tree | 5f2fb23f2bf676a8424fa529475d39a50bd127ee | |
parent | Use `define-repeat-map` (diff) | |
download | emacs-5b7fbf4bc65268533e16bde4ad6198537b85ee41.tar.gz emacs-5b7fbf4bc65268533e16bde4ad6198537b85ee41.zip |
Change acdw/reading-mode to reading-mode
-rw-r--r-- | init.el | 32 | ||||
-rw-r--r-- | lisp/acdw-reading.el | 51 | ||||
-rw-r--r-- | lisp/acdw.el | 41 |
3 files changed, 67 insertions, 57 deletions
diff --git a/init.el b/init.el index 09a4239..8263b05 100644 --- a/init.el +++ b/init.el | |||
@@ -26,8 +26,8 @@ | |||
26 | (:option 0x0-default-server 'ttm)) | 26 | (:option 0x0-default-server 'ttm)) |
27 | 27 | ||
28 | (setup Info | 28 | (setup Info |
29 | (:hook variable-pitch-mode | 29 | (:hook #'variable-pitch-mode |
30 | acdw/reading-mode)) | 30 | #'reading-mode)) |
31 | 31 | ||
32 | (setup abbrev | 32 | (setup abbrev |
33 | (:option abbrev-file-name "~/Sync/abbrev.el" | 33 | (:option abbrev-file-name "~/Sync/abbrev.el" |
@@ -37,7 +37,8 @@ | |||
37 | 37 | ||
38 | (setup acdw | 38 | (setup acdw |
39 | (:also-load acdw-compat | 39 | (:also-load acdw-compat |
40 | acdw-lisp) | 40 | acdw-lisp |
41 | acdw-reading) | ||
41 | (acdw/require-private) | 42 | (acdw/require-private) |
42 | 43 | ||
43 | (:option user-full-name "Case Duckworth" | 44 | (:option user-full-name "Case Duckworth" |
@@ -62,10 +63,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
62 | (car feature) | 63 | (car feature) |
63 | feature)) | 64 | feature)) |
64 | (car name)) | 65 | (car name)) |
65 | name))))))) | 66 | name)))))))) |
66 | |||
67 | (:global "C-x o" #'acdw/other-window-or-switch-buffer | ||
68 | "C-x O" #'acdw/other-window-or-switch-buffer-backward)) | ||
69 | 67 | ||
70 | (setup (:straight-if affe | 68 | (setup (:straight-if affe |
71 | (and (or (executable-find "fd") | 69 | (and (or (executable-find "fd") |
@@ -610,8 +608,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
610 | ((t (:height 1.5)))) | 608 | ((t (:height 1.5)))) |
611 | 609 | ||
612 | (:with-mode elfeed-show-mode | 610 | (:with-mode elfeed-show-mode |
613 | (:hook (defun elfeed-show@setup () | 611 | (:hook #'reading-mode) |
614 | (acdw/reading-mode))) | ||
615 | 612 | ||
616 | ;; see https://irreal.org/blog/?p=8885 | 613 | ;; see https://irreal.org/blog/?p=8885 |
617 | (:bind "SPC" (defun elfeed-scroll-up-command (&optional arg) | 614 | (:bind "SPC" (defun elfeed-scroll-up-command (&optional arg) |
@@ -678,7 +675,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
678 | "o" #'elpher-follow-current-link | 675 | "o" #'elpher-follow-current-link |
679 | "G" #'elpher-go-current) | 676 | "G" #'elpher-go-current) |
680 | 677 | ||
681 | (:hook #'acdw/reading-mode) | 678 | (:hook #'reading-mode) |
682 | 679 | ||
683 | (:autoload (elpher-bookmarks :interactive t) | 680 | (:autoload (elpher-bookmarks :interactive t) |
684 | (elpher-go :interactive t)) | 681 | (elpher-go :interactive t)) |
@@ -726,7 +723,9 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
726 | (:global "M-=" #'count-words | 723 | (:global "M-=" #'count-words |
727 | "C-w" #'kill-region-or-backward-word | 724 | "C-w" #'kill-region-or-backward-word |
728 | "C-c d" #'acdw/insert-iso-date | 725 | "C-c d" #'acdw/insert-iso-date |
729 | "M-`" nil) | 726 | "M-`" nil |
727 | "C-x o" #'acdw/other-window-or-switch-buffer | ||
728 | "C-x O" #'acdw/other-window-or-switch-buffer-backward) | ||
730 | 729 | ||
731 | (:with-map toggle-map | 730 | (:with-map toggle-map |
732 | (:bind "c" #'column-number-mode | 731 | (:bind "c" #'column-number-mode |
@@ -875,7 +874,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
875 | (:option eww-search-prefix "https://duckduckgo.com/html?q=" | 874 | (:option eww-search-prefix "https://duckduckgo.com/html?q=" |
876 | url-privacy-level '(email agent cookies lastloc)) | 875 | url-privacy-level '(email agent cookies lastloc)) |
877 | 876 | ||
878 | (:hook #'acdw/reading-mode)) | 877 | (:hook #'reading-mode)) |
879 | 878 | ||
880 | (setup (:straight-if exec-path-from-shell | 879 | (setup (:straight-if exec-path-from-shell |
881 | (acdw/system :home)) | 880 | (acdw/system :home)) |
@@ -1174,11 +1173,12 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1174 | 1173 | ||
1175 | ;; Setup for different modes. | 1174 | ;; Setup for different modes. |
1176 | ;; There has /got/ to be an easier way here! | 1175 | ;; There has /got/ to be an easier way here! |
1177 | (let ((key ";")) | 1176 | (dolist (key '(";" "o")) |
1178 | (:with-mode special-mode (:bind key #'link-hint-open-link)) | 1177 | (:with-mode special-mode (:bind key #'link-hint-open-link)) |
1179 | (:with-mode help-mode (:bind key #'link-hint-open-link)) | 1178 | (:with-mode help-mode (:bind key #'link-hint-open-link)) |
1180 | (:with-feature helpful (:bind key #'link-hint-open-link)) | 1179 | (:with-feature helpful (:bind key #'link-hint-open-link)) |
1181 | (:with-mode Info-mode (:bind key #'link-hint-open-link)))) | 1180 | (:with-mode Info-mode (:bind key #'link-hint-open-link)) |
1181 | (:with-mode reading-mode (:bind key #'link-hint-open-link)))) | ||
1182 | 1182 | ||
1183 | (setup (:straight lua-mode) | 1183 | (setup (:straight lua-mode) |
1184 | (:file-match (rx ".lua" eos))) | 1184 | (:file-match (rx ".lua" eos))) |
@@ -1224,7 +1224,7 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1224 | mastodon-client--token-file (acdw/dir "mastodon.plstore")) | 1224 | mastodon-client--token-file (acdw/dir "mastodon.plstore")) |
1225 | 1225 | ||
1226 | (:hook #'hl-line-mode | 1226 | (:hook #'hl-line-mode |
1227 | #'acdw/reading-mode)) | 1227 | #'reading-mode)) |
1228 | 1228 | ||
1229 | (setup minibuffer | 1229 | (setup minibuffer |
1230 | (:option enable-recursive-minibuffers t | 1230 | (:option enable-recursive-minibuffers t |
@@ -1862,7 +1862,7 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
1862 | (:option view-read-only t) | 1862 | (:option view-read-only t) |
1863 | 1863 | ||
1864 | (:hook (defun acdw/read-view-mode () | 1864 | (:hook (defun acdw/read-view-mode () |
1865 | (acdw/reading-mode (if view-mode +1 -1))))) | 1865 | (reading-mode (if view-mode +1 -1))))) |
1866 | 1866 | ||
1867 | (setup (:straight visual-regexp) | 1867 | (setup (:straight visual-regexp) |
1868 | (:global "M-%" #'vr/query-replace)) | 1868 | (:global "M-%" #'vr/query-replace)) |
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 | ||