diff options
-rw-r--r-- | init.el | 59 | ||||
-rw-r--r-- | lisp/acdw-reading.el | 103 |
2 files changed, 103 insertions, 59 deletions
diff --git a/init.el b/init.el index edfbda6..7e517d6 100644 --- a/init.el +++ b/init.el | |||
@@ -1009,7 +1009,8 @@ specific to most general, they are these: | |||
1009 | circe-network-inhibit-autoconnect '("Pissnet" "Twitch IRC") | 1009 | circe-network-inhibit-autoconnect '("Pissnet" "Twitch IRC") |
1010 | circe-network-options | 1010 | circe-network-options |
1011 | `(("Libera Chat" | 1011 | `(("Libera Chat" |
1012 | :channels ("#emacs" "#systemcrafters" "##webpals") | 1012 | :channels ("#emacs" "#systemcrafters" "##webpals" |
1013 | "#emacsconf-org") | ||
1013 | :sasl-username ,circe-default-nick | 1014 | :sasl-username ,circe-default-nick |
1014 | :sasl-password ,(acdw/make-password-fetcher | 1015 | :sasl-password ,(acdw/make-password-fetcher |
1015 | :host "libera.chat")) | 1016 | :host "libera.chat")) |
@@ -1056,7 +1057,8 @@ specific to most general, they are these: | |||
1056 | #'enable-circe-color-nicks | 1057 | #'enable-circe-color-nicks |
1057 | ;; #'enable-circe-display-images | 1058 | ;; #'enable-circe-display-images |
1058 | #'enable-circe-new-day-notifier | 1059 | #'enable-circe-new-day-notifier |
1059 | #'circe-chat@set-prompt) | 1060 | #'circe-chat@set-prompt |
1061 | #'topsy-mode)) | ||
1060 | (:bind "C-c C-s" #'circe-command-SLAP)) | 1062 | (:bind "C-c C-s" #'circe-command-SLAP)) |
1061 | 1063 | ||
1062 | (autoload 'circe-nick-color-reset "circe-color-nicks") | 1064 | (autoload 'circe-nick-color-reset "circe-color-nicks") |
@@ -1065,13 +1067,16 @@ specific to most general, they are these: | |||
1065 | 1067 | ||
1066 | (:with-mode lui-mode | 1068 | (:with-mode lui-mode |
1067 | (:option lui-fill-column (+ fill-column acdw-irc/left-margin) | 1069 | (:option lui-fill-column (+ fill-column acdw-irc/left-margin) |
1068 | lui-fill-type (repeat-string acdw-irc/left-margin " ") | 1070 | lui-fill-type nil ;;(repeat-string acdw-irc/left-margin " ") |
1069 | lui-time-stamp-position 'right-margin | 1071 | lui-time-stamp-position 'right-margin |
1070 | lui-time-stamp-format "%H:%M" | 1072 | lui-time-stamp-format "%H:%M" |
1071 | lui-track-behavior 'before-switch-to-buffer | 1073 | lui-track-behavior 'before-switch-to-buffer |
1072 | lui-track-indicator 'fringe | 1074 | lui-track-indicator 'fringe |
1073 | lui-fill-remove-face-from-newline nil) | 1075 | lui-fill-remove-face-from-newline nil) |
1074 | 1076 | ||
1077 | (:hook #'visual-fill-column-mode | ||
1078 | #'visual-line-mode) | ||
1079 | |||
1075 | (:local-set fringes-outside-margins t | 1080 | (:local-set fringes-outside-margins t |
1076 | right-margin-width 5 | 1081 | right-margin-width 5 |
1077 | scroll-margin 0 | 1082 | scroll-margin 0 |
@@ -1184,8 +1189,8 @@ specific to most general, they are these: | |||
1184 | (crux-reopen-as-root-mode +1)) | 1189 | (crux-reopen-as-root-mode +1)) |
1185 | 1190 | ||
1186 | (setup (:straight-if (define-repeat-map | 1191 | (setup (:straight-if (define-repeat-map |
1187 | :host nil | 1192 | :host nil |
1188 | :repo "https://tildegit.org/acdw/define-repeat-map.el") | 1193 | :repo "https://tildegit.org/acdw/define-repeat-map.el") |
1189 | (acdw/system :home)) | 1194 | (acdw/system :home)) |
1190 | 1195 | ||
1191 | (require 'define-repeat-map ; just for me | 1196 | (require 'define-repeat-map ; just for me |
@@ -1737,6 +1742,17 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1737 | indicate-buffer-boundaries nil) | 1742 | indicate-buffer-boundaries nil) |
1738 | (acdw/setup-fringes))))) | 1743 | (acdw/setup-fringes))))) |
1739 | 1744 | ||
1745 | (setup (:straight visual-fill-column) | ||
1746 | (:option visual-fill-column-width (+ fill-column 4) | ||
1747 | visual-fill-column-center-text t | ||
1748 | (append reading-modes) '(visual-fill-column-mode . +1)) | ||
1749 | (:hook (defun visual-fill-column@setup () | ||
1750 | (if visual-fill-column-mode | ||
1751 | (setq-local indicate-empty-lines nil | ||
1752 | indicate-buffer-boundaries nil) | ||
1753 | (acdw/setup-fringes)))) | ||
1754 | (:advise text-scale-adjust :after #'visual-fill-column-adjust)) | ||
1755 | |||
1740 | (setup (:straight (orderless | 1756 | (setup (:straight (orderless |
1741 | :host github | 1757 | :host github |
1742 | :repo "oantolin/orderless")) | 1758 | :repo "oantolin/orderless")) |
@@ -1797,8 +1813,19 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1797 | ((string-suffix-p "~" pattern) | 1813 | ((string-suffix-p "~" pattern) |
1798 | `(orderless-flex . ,(substring pattern 0 -1)))))) | 1814 | `(orderless-flex . ,(substring pattern 0 -1)))))) |
1799 | 1815 | ||
1800 | (setup (:straight org | 1816 | (setup (:straight (org |
1801 | org-contrib) | 1817 | :type git |
1818 | :repo "https://git.savannah.gnu.org/git/emacs/org-mode.git" | ||
1819 | :local-repo "org" | ||
1820 | :depth full | ||
1821 | :pre-build (straight-recipes-org-elpa--build) | ||
1822 | :build (:not autoloads) | ||
1823 | :files (:defaults | ||
1824 | "lisp/*.el" | ||
1825 | ("etc/styles/" "etc/styles/*"))) | ||
1826 | (org-contrib | ||
1827 | :type git | ||
1828 | :repo "https://git.sr.ht/~bzg/org-contrib")) | ||
1802 | (:also-load acdw-org) | 1829 | (:also-load acdw-org) |
1803 | (require 'chd nil 'noerror) | 1830 | (require 'chd nil 'noerror) |
1804 | (:option org-adapt-indentation nil | 1831 | (:option org-adapt-indentation nil |
@@ -2284,24 +2311,6 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
2284 | winum-ignored-buffers '(" *which-key*") | 2311 | winum-ignored-buffers '(" *which-key*") |
2285 | winum-format " %s") | 2312 | winum-format " %s") |
2286 | 2313 | ||
2287 | (when-unfocused winum-map-keys | ||
2288 | (defvar winum--keys-mapped nil | ||
2289 | "Whether `winum' keys have been mapped already.") | ||
2290 | (when (and (not winum--keys-mapped) | ||
2291 | (display-graphic-p)) | ||
2292 | (:with-map winum-keymap | ||
2293 | (:bind "M-0" #'winum-select-window-0-or-10 | ||
2294 | "M-1" #'winum-select-window-1 | ||
2295 | "M-2" #'winum-select-window-2 | ||
2296 | "M-3" #'winum-select-window-3 | ||
2297 | "M-4" #'winum-select-window-4 | ||
2298 | "M-5" #'winum-select-window-5 | ||
2299 | "M-6" #'winum-select-window-6 | ||
2300 | "M-7" #'winum-select-window-7 | ||
2301 | "M-8" #'winum-select-window-8 | ||
2302 | "M-9" #'winum-select-window-9)) | ||
2303 | (setq winum--keys-mapped t))) | ||
2304 | |||
2305 | (winum-mode +1)) | 2314 | (winum-mode +1)) |
2306 | 2315 | ||
2307 | (setup (:straight xr)) | 2316 | (setup (:straight xr)) |
diff --git a/lisp/acdw-reading.el b/lisp/acdw-reading.el index 5d43dac..ff4f0c2 100644 --- a/lisp/acdw-reading.el +++ b/lisp/acdw-reading.el | |||
@@ -17,8 +17,60 @@ | |||
17 | 17 | ||
18 | ;;; Code: | 18 | ;;; Code: |
19 | 19 | ||
20 | (defvar-local //indicate-empty-lines nil) | 20 | ;;; Customizations |
21 | (defvar-local //indicate-buffer-boundaries nil) | 21 | |
22 | (defgroup reading nil | ||
23 | "Group for Reading mode customizations." | ||
24 | :prefix "reading-" | ||
25 | :group 'convenience) ; i need to figure this out | ||
26 | |||
27 | (defcustom reading-vars '((indicate-empty-lines . nil) | ||
28 | (indicate-buffer-boundaries . nil)) | ||
29 | "Alist of variables to set in function `reading-mode'. | ||
30 | The car of each cell is the variable name, and the cdr is the | ||
31 | value to set it to." | ||
32 | :type '(alist :key-type variable | ||
33 | :value-type sexp)) | ||
34 | |||
35 | (defcustom reading-modes '((display-fill-column-indicator-mode . -1) | ||
36 | (blink-cursor-mode . -1)) | ||
37 | "Alist of modes to set in function `reading-mode'. | ||
38 | The car of each cell is the function name, and the cdr is the | ||
39 | value to call it with." | ||
40 | :type '(alist :key-type function | ||
41 | :value-type sexp)) | ||
42 | |||
43 | ;;; Internal | ||
44 | |||
45 | (defvar reading--remembered-template "reading--remembered-%s-value" | ||
46 | "The template passed to `format' for remembered modes and variables.") | ||
47 | |||
48 | (defun reading--remember (things func) | ||
49 | "Apply FUNC to THINGS, remembering their previous value for later." | ||
50 | (declare (indent 1)) | ||
51 | (unless (listp things) | ||
52 | (setq things (list things))) | ||
53 | (dolist (thing things) | ||
54 | (set (make-local-variable | ||
55 | (intern (format reading--remembered-template thing))) | ||
56 | (and (boundp thing) | ||
57 | (symbol-value thing))) | ||
58 | (funcall func thing))) | ||
59 | |||
60 | (defun reading--recall (things func) | ||
61 | "Recall previously remembered THINGS by applying FUNC to them. | ||
62 | FUNC should be a function with the signature (THING REMEMBERED-SETTING)." | ||
63 | (declare (indent 1)) | ||
64 | (unless (listp things) | ||
65 | (setq things (list things))) | ||
66 | (dolist (thing things) | ||
67 | (with-demoted-errors "reading--recall: %S" | ||
68 | (let ((value (symbol-value | ||
69 | (intern | ||
70 | (format reading--remembered-template thing))))) | ||
71 | (funcall func thing value))))) | ||
72 | |||
73 | ;;; Mode | ||
22 | 74 | ||
23 | ;;;###autoload | 75 | ;;;###autoload |
24 | (define-minor-mode reading-mode | 76 | (define-minor-mode reading-mode |
@@ -27,39 +79,22 @@ | |||
27 | :lighter " Read" | 79 | :lighter " Read" |
28 | :keymap (make-sparse-keymap) | 80 | :keymap (make-sparse-keymap) |
29 | (if reading-mode | 81 | (if reading-mode |
30 | (progn ;; turn on | 82 | ;; turn on |
31 | ;; settings | 83 | (progn |
32 | (setq-local //indicate-empty-lines indicate-empty-lines | 84 | (reading--remember (mapcar #'car reading-vars) |
33 | indicate-empty-lines nil | 85 | (lambda (var) |
34 | //indicate-buffer-boundaries indicate-buffer-boundaries | 86 | (set (make-local-variable var) |
35 | indicate-buffer-boundaries nil) | 87 | (cdr (assoc var reading-vars))))) |
36 | ;; disable modes | 88 | (reading--remember (mapcar #'car reading-modes) |
37 | (dolist (mode '(display-fill-column-indicator-mode | 89 | (lambda (mode) |
38 | blink-cursor-mode)) | 90 | (funcall mode (cdr (assoc mode reading-modes)))))) |
39 | (when (fboundp mode) | ||
40 | (set (make-local-variable | ||
41 | (intern (format "//%s" mode))) | ||
42 | (symbol-value mode)) | ||
43 | (funcall mode -1))) | ||
44 | ;; enable modes | ||
45 | (dolist (mode '(olivetti-mode)) | ||
46 | (when (fboundp mode) | ||
47 | (set (make-local-variable | ||
48 | (intern (format "//%s" mode))) | ||
49 | (symbol-value mode)) | ||
50 | (funcall mode +1)))) | ||
51 | ;; turn off | 91 | ;; turn off |
52 | ;; restore settings | 92 | (reading--recall (mapcar #'car reading-vars) |
53 | (setq-local indicate-empty-lines //indicate-empty-lines | 93 | (lambda (var orig-val) |
54 | indicate-buffer-boundaries //indicate-buffer-boundaries) | 94 | (set (make-local-variable var) orig-val))) |
55 | ;; restore modes | 95 | (reading--recall (mapcar #'car reading-modes) |
56 | (dolist (mode '(display-fill-column-indicator-mode | 96 | (lambda (mode orig-setting) |
57 | olivetti-mode | 97 | (funcall mode (if orig-setting +1 -1)))))) |
58 | blink-cursor-mode)) | ||
59 | (when (fboundp mode) | ||
60 | (funcall mode (if (symbol-value (intern (format "//%s" mode))) | ||
61 | +1 | ||
62 | -1)))))) | ||
63 | 98 | ||
64 | (provide 'acdw-reading) | 99 | (provide 'acdw-reading) |
65 | ;;; acdw-reading.el ends here | 100 | ;;; acdw-reading.el ends here |