diff options
author | Case Duckworth | 2022-05-06 10:23:57 -0500 |
---|---|---|
committer | Case Duckworth | 2022-05-06 10:23:57 -0500 |
commit | 6e7d7fe47d34a7e301ccf8027a234785bacb3297 (patch) | |
tree | ff210617e264c7d0ff633bcd8ac3398c17517010 | |
parent | meh (diff) | |
parent | Don't query to install pdf-tools (diff) | |
download | emacs-6e7d7fe47d34a7e301ccf8027a234785bacb3297.tar.gz emacs-6e7d7fe47d34a7e301ccf8027a234785bacb3297.zip |
Merge branch 'main' of tildegit.org:acdw/emacs
-rw-r--r-- | init.el | 22 | ||||
-rw-r--r-- | lisp/+Info.el | 67 | ||||
-rw-r--r-- | lisp/+modeline.el | 68 | ||||
-rw-r--r-- | lisp/acdw.el | 3 |
4 files changed, 121 insertions, 39 deletions
diff --git a/init.el b/init.el index 206ba45..d67f8e7 100644 --- a/init.el +++ b/init.el | |||
@@ -301,7 +301,8 @@ | |||
301 | #'hl-line-mode | 301 | #'hl-line-mode |
302 | #'lin-mode | 302 | #'lin-mode |
303 | #'+dired-dim-git-ignores) | 303 | #'+dired-dim-git-ignores) |
304 | (:+key "C-x C-j" #'dired-jump) | 304 | (+with-ensure-after-init ; Necessary because jabber loads later |
305 | (:+key "C-x C-j" #'dired-jump)) | ||
305 | (dolist (refresh-after-func '(dired-do-flagged-delete)) | 306 | (dolist (refresh-after-func '(dired-do-flagged-delete)) |
306 | (advice-add refresh-after-func :after #'revert-buffer)) | 307 | (advice-add refresh-after-func :after #'revert-buffer)) |
307 | (with-eval-after-load 'frowny | 308 | (with-eval-after-load 'frowny |
@@ -369,7 +370,7 @@ | |||
369 | ;; Bind keys | 370 | ;; Bind keys |
370 | (dolist (binding '(("C-d" . +eshell-quit-or-delete-char))) | 371 | (dolist (binding '(("C-d" . +eshell-quit-or-delete-char))) |
371 | (define-key eshell-mode-map | 372 | (define-key eshell-mode-map |
372 | (kbd (car binding)) (cdr binding))) | 373 | (kbd (car binding)) (cdr binding))) |
373 | ;; Environment variables | 374 | ;; Environment variables |
374 | (dolist (environment '(("PAGER" . "cat"))) | 375 | (dolist (environment '(("PAGER" . "cat"))) |
375 | (setenv (car environment) (cdr environment))))) | 376 | (setenv (car environment) (cdr environment))))) |
@@ -436,6 +437,8 @@ | |||
436 | (add-to-list 'Info-additional-directory-list dir)) | 437 | (add-to-list 'Info-additional-directory-list dir)) |
437 | (:with-mode Info-mode ; -_- | 438 | (:with-mode Info-mode ; -_- |
438 | (:hook #'reading-mode) | 439 | (:hook #'reading-mode) |
440 | (:local-set +modeline-buffer-position #'+Info-modeline-breadcrumbs | ||
441 | +modeline-position-function #'ignore) | ||
439 | (:bind "c" #'+Info-copy-current-node-name | 442 | (:bind "c" #'+Info-copy-current-node-name |
440 | "w" #'+Info-copy-current-node-name))) | 443 | "w" #'+Info-copy-current-node-name))) |
441 | 444 | ||
@@ -1561,7 +1564,6 @@ | |||
1561 | t))) | 1564 | t))) |
1562 | 1565 | ||
1563 | (setup (:straight epithet) | 1566 | (setup (:straight epithet) |
1564 | (add-hook 'epithet-suggesters #'epithet-for-eww-url) | ||
1565 | (dolist (hook '(Info-selection-hook | 1567 | (dolist (hook '(Info-selection-hook |
1566 | ;; eww-after-render-hook | 1568 | ;; eww-after-render-hook |
1567 | help-mode-hook | 1569 | help-mode-hook |
@@ -1758,6 +1760,8 @@ | |||
1758 | (setup (:straight info+) | 1760 | (setup (:straight info+) |
1759 | (:load-after info) | 1761 | (:load-after info) |
1760 | (:option Info-fontify-isolated-quote-flag nil | 1762 | (:option Info-fontify-isolated-quote-flag nil |
1763 | Info-breadcrumbs-in-mode-line-mode nil | ||
1764 | Info-fontify-emphasis-flag nil | ||
1761 | Info-fontify-quotations nil | 1765 | Info-fontify-quotations nil |
1762 | Info-saved-history-file (.etc "info-history")) | 1766 | Info-saved-history-file (.etc "info-history")) |
1763 | (add-hook 'Info-mode-hook #'Info-variable-pitch-text-mode)) | 1767 | (add-hook 'Info-mode-hook #'Info-variable-pitch-text-mode)) |
@@ -1844,6 +1848,7 @@ | |||
1844 | (cond | 1848 | (cond |
1845 | ((string-match-p "hmm@" (buffer-name)) | 1849 | ((string-match-p "hmm@" (buffer-name)) |
1846 | "🤔 "))) | 1850 | "🤔 "))) |
1851 | file-percentage-mode nil | ||
1847 | wrap-prefix (make-string +jabber-ws-prefix ?\ ))) | 1852 | wrap-prefix (make-string +jabber-ws-prefix ?\ ))) |
1848 | (:+leader "C-j" jabber-global-keymap) | 1853 | (:+leader "C-j" jabber-global-keymap) |
1849 | (advice-add 'jabber-activity-add :after #'+jabber-tracking-add) | 1854 | (advice-add 'jabber-activity-add :after #'+jabber-tracking-add) |
@@ -2172,7 +2177,7 @@ | |||
2172 | (executable-find "g++"))) | 2177 | (executable-find "g++"))) |
2173 | (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal) | 2178 | (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal) |
2174 | #'pdf-view-mode) | 2179 | #'pdf-view-mode) |
2175 | (pdf-tools-install t)) | 2180 | (pdf-tools-install :no-query)) |
2176 | 2181 | ||
2177 | (setup (:straight (plancat | 2182 | (setup (:straight (plancat |
2178 | :host github | 2183 | :host github |
@@ -2219,7 +2224,7 @@ | |||
2219 | (readonly . "=") | 2224 | (readonly . "=") |
2220 | (modified . "+") | 2225 | (modified . "+") |
2221 | (t . "-")) | 2226 | (t . "-")) |
2222 | +modeline-minions-icon ";" | 2227 | +modeline-minions-icon "&" |
2223 | +modeline-buffer-name-max-length 0.35) | 2228 | +modeline-buffer-name-max-length 0.35) |
2224 | ;; Segments | 2229 | ;; Segments |
2225 | (:option simple-modeline-segments | 2230 | (:option simple-modeline-segments |
@@ -2228,9 +2233,6 @@ | |||
2228 | +modeline-modified | 2233 | +modeline-modified |
2229 | +modeline-buffer-name | 2234 | +modeline-buffer-name |
2230 | (lambda () (+modeline-vc " : ")) | 2235 | (lambda () (+modeline-vc " : ")) |
2231 | ,(+modeline-concat | ||
2232 | '(+modeline-minions | ||
2233 | +modeline-major-mode)) | ||
2234 | +modeline-anzu | 2236 | +modeline-anzu |
2235 | ) | 2237 | ) |
2236 | ( ; right | 2238 | ( ; right |
@@ -2249,6 +2251,10 @@ | |||
2249 | ",") | 2251 | ",") |
2250 | +modeline-input-method | 2252 | +modeline-input-method |
2251 | +modeline-position | 2253 | +modeline-position |
2254 | ,(+modeline-concat | ||
2255 | '(+modeline-minions | ||
2256 | +modeline-major-mode)) | ||
2257 | +modeline-file-percentage | ||
2252 | ))) | 2258 | ))) |
2253 | (simple-modeline-mode +1)) | 2259 | (simple-modeline-mode +1)) |
2254 | 2260 | ||
diff --git a/lisp/+Info.el b/lisp/+Info.el index a3c2fcd..46bd5f8 100644 --- a/lisp/+Info.el +++ b/lisp/+Info.el | |||
@@ -13,5 +13,72 @@ arg reversed." | |||
13 | (interactive "P" Info-mode) | 13 | (interactive "P" Info-mode) |
14 | (Info-copy-current-node-name (unless arg 0))) | 14 | (Info-copy-current-node-name (unless arg 0))) |
15 | 15 | ||
16 | (defun +Info-modeline-breadcrumbs () | ||
17 | (let ((nodes (Info-toc-nodes Info-current-file)) | ||
18 | (node Info-current-node) | ||
19 | (crumbs ()) | ||
20 | (depth Info-breadcrumbs-depth-internal) | ||
21 | (text "")) | ||
22 | ;; Get ancestors from the cached parent-children node info | ||
23 | (while (and (not (equal "Top" node)) (> depth 0)) | ||
24 | (setq node (nth 1 (assoc node nodes))) | ||
25 | (when node (push node crumbs)) | ||
26 | (setq depth (1- depth))) | ||
27 | ;; Add bottom node. | ||
28 | (setq crumbs (nconc crumbs (list Info-current-node))) | ||
29 | (when crumbs | ||
30 | ;; Add top node (and continuation if needed). | ||
31 | (setq crumbs (cons "Top" (if (member (pop crumbs) '(nil "Top")) | ||
32 | crumbs | ||
33 | (cons nil crumbs)))) | ||
34 | (dolist (node crumbs) | ||
35 | (let ((crumbs-map (make-sparse-keymap)) | ||
36 | (menu-map (make-sparse-keymap "Breadcrumbs in Mode Line"))) | ||
37 | (define-key crumbs-map [mode-line mouse-3] menu-map) | ||
38 | (when node | ||
39 | (define-key menu-map [Info-prev] | ||
40 | `(menu-item "Previous Node" Info-prev | ||
41 | :visible ,(Info-check-pointer "prev[ious]*") :help "Go to the previous node")) | ||
42 | (define-key menu-map [Info-next] | ||
43 | `(menu-item "Next Node" Info-next | ||
44 | :visible ,(Info-check-pointer "next") :help "Go to the next node")) | ||
45 | (define-key menu-map [separator] '("--")) | ||
46 | (define-key menu-map [Info-breadcrumbs-in-mode-line-mode] | ||
47 | `(menu-item "Toggle Breadcrumbs" Info-breadcrumbs-in-mode-line-mode | ||
48 | :help "Toggle displaying breadcrumbs in the Info mode-line" | ||
49 | :button (:toggle . Info-breadcrumbs-in-mode-line-mode))) | ||
50 | (define-key menu-map [Info-set-breadcrumbs-depth] | ||
51 | `(menu-item "Set Breadcrumbs Depth" Info-set-breadcrumbs-depth | ||
52 | :help "Set depth of breadcrumbs to show in the mode-line")) | ||
53 | (setq node (if (equal node Info-current-node) | ||
54 | (propertize | ||
55 | (replace-regexp-in-string "%" "%%" Info-current-node) | ||
56 | 'face 'mode-line-buffer-id | ||
57 | 'help-echo "mouse-1: Scroll back, mouse-2: Scroll forward, mouse-3: Menu" | ||
58 | 'mouse-face 'mode-line-highlight | ||
59 | 'local-map | ||
60 | (progn | ||
61 | (define-key crumbs-map [mode-line mouse-1] 'Info-mouse-scroll-down) | ||
62 | (define-key crumbs-map [mode-line mouse-2] 'Info-mouse-scroll-up) | ||
63 | crumbs-map)) | ||
64 | (propertize | ||
65 | node | ||
66 | 'local-map (progn (define-key crumbs-map [mode-line mouse-1] | ||
67 | `(lambda () (interactive) (Info-goto-node ,node))) | ||
68 | (define-key crumbs-map [mode-line mouse-2] | ||
69 | `(lambda () (interactive) (Info-goto-node ,node))) | ||
70 | crumbs-map) | ||
71 | 'mouse-face 'mode-line-highlight | ||
72 | 'help-echo "mouse-1, mouse-2: Go to this node; mouse-3: Menu"))))) | ||
73 | (let ((nodetext (if (not (equal node "Top")) | ||
74 | node | ||
75 | (concat (format "(%s)" (if (stringp Info-current-file) | ||
76 | (file-name-nondirectory Info-current-file) | ||
77 | ;; Some legacy code can still use a symbol. | ||
78 | Info-current-file)) | ||
79 | node)))) | ||
80 | (setq text (concat text (if (equal node "Top") "" " > ") (if node nodetext "..."))))) | ||
81 | text))) | ||
82 | |||
16 | (provide '+Info) | 83 | (provide '+Info) |
17 | ;;; +Info.el ends here | 84 | ;;; +Info.el ends here |
diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 3a922e3..e5b5bc6 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el | |||
@@ -72,26 +72,34 @@ and appended with `truncate-string-ellipsis'." | |||
72 | (natnum :tag "Number of characters") | 72 | (natnum :tag "Number of characters") |
73 | (float :tag "Fraction of window's width"))) | 73 | (float :tag "Fraction of window's width"))) |
74 | 74 | ||
75 | (defcustom +modeline-buffer-position nil | ||
76 | "What to put in the `+modeline-buffer-name' position." | ||
77 | :type 'function | ||
78 | :local t) | ||
79 | |||
75 | (defun +modeline-buffer-name (&optional spacer) ; gonsie | 80 | (defun +modeline-buffer-name (&optional spacer) ; gonsie |
76 | "Display the buffer name." | 81 | "Display the buffer name." |
77 | (let ((bufname (string-trim (string-replace "%" "" (buffer-name))))) | 82 | (let ((bufname (string-trim (string-replace "%" "" (buffer-name))))) |
78 | (concat (or spacer +modeline-default-spacer) | 83 | (concat (or spacer +modeline-default-spacer) |
79 | (propertize (cond | 84 | (if (and +modeline-buffer-position (fboundp +modeline-buffer-position)) |
80 | ((ignore-errors | 85 | (funcall +modeline-buffer-position) |
81 | (and (> +modeline-buffer-name-max-length 0) | 86 | (propertize (cond |
82 | (< +modeline-buffer-name-max-length 1))) | 87 | ((ignore-errors |
83 | (truncate-string-to-width bufname | 88 | (and (> +modeline-buffer-name-max-length 0) |
84 | (* (window-total-width) +modeline-buffer-name-max-length) | 89 | (< +modeline-buffer-name-max-length 1))) |
85 | nil nil t)) | 90 | (truncate-string-to-width bufname |
86 | ((ignore-errors | 91 | (* (window-total-width) |
87 | (> +modeline-buffer-name-max-length 1)) | 92 | +modeline-buffer-name-max-length) |
88 | (truncate-string-to-width bufname | 93 | nil nil t)) |
89 | +modeline-buffer-name-max-length | 94 | ((ignore-errors |
90 | nil nil t)) | 95 | (> +modeline-buffer-name-max-length 1)) |
91 | (t bufname)) | 96 | (truncate-string-to-width bufname |
92 | 'help-echo (or (buffer-file-name) | 97 | +modeline-buffer-name-max-length |
93 | (buffer-name)) | 98 | nil nil t)) |
94 | 'mouse-face 'mode-line-highlight)))) | 99 | (t bufname)) |
100 | 'help-echo (or (buffer-file-name) | ||
101 | (buffer-name)) | ||
102 | 'mouse-face 'mode-line-highlight))))) | ||
95 | 103 | ||
96 | (defcustom +modeline-minions-icon "&" | 104 | (defcustom +modeline-minions-icon "&" |
97 | "The \"icon\" for `+modeline-minions' button." | 105 | "The \"icon\" for `+modeline-minions' button." |
@@ -152,17 +160,17 @@ The order of elements matters: whichever one matches first is applied." | |||
152 | (defun +modeline-modified (&optional spacer) ; modified from `simple-modeline-status-modified' | 160 | (defun +modeline-modified (&optional spacer) ; modified from `simple-modeline-status-modified' |
153 | "Display a color-coded \"icon\" indicator for the buffer's status." | 161 | "Display a color-coded \"icon\" indicator for the buffer's status." |
154 | (let* ((icon (catch :icon | 162 | (let* ((icon (catch :icon |
155 | (dolist (cell +modeline-modified-icon-alist) | 163 | (dolist (cell +modeline-modified-icon-alist) |
156 | (when (pcase (car cell) | 164 | (when (pcase (car cell) |
157 | ('ephemeral (not (buffer-file-name))) | 165 | ('ephemeral (not (buffer-file-name))) |
158 | ('readonly buffer-read-only) | 166 | ('readonly buffer-read-only) |
159 | ('modified (buffer-modified-p)) | 167 | ('modified (buffer-modified-p)) |
160 | ('special | 168 | ('special |
161 | (apply 'derived-mode-p | 169 | (apply 'derived-mode-p |
162 | +modeline-modified-icon-special-modes)) | 170 | +modeline-modified-icon-special-modes)) |
163 | ('t t) | 171 | ('t t) |
164 | (_ nil)) | 172 | (_ nil)) |
165 | (throw :icon cell)))))) | 173 | (throw :icon cell)))))) |
166 | (concat (or spacer +modeline-default-spacer) | 174 | (concat (or spacer +modeline-default-spacer) |
167 | (propertize (or (cdr-safe icon) "") | 175 | (propertize (or (cdr-safe icon) "") |
168 | 'help-echo (format "Buffer \"%s\" is %s." | 176 | 'help-echo (format "Buffer \"%s\" is %s." |
@@ -244,7 +252,8 @@ The order of elements matters: whichever one matches first is applied." | |||
244 | perc | 252 | perc |
245 | (unless (seq-some (lambda (s) (string= perc s)) | 253 | (unless (seq-some (lambda (s) (string= perc s)) |
246 | '("Top" "Bot" "All")) | 254 | '("Top" "Bot" "All")) |
247 | "%%%%"))))) | 255 | "%%%%") |
256 | " ")))) | ||
248 | 257 | ||
249 | (defun +modeline-file-percentage-icon (&optional spacer) | 258 | (defun +modeline-file-percentage-icon (&optional spacer) |
250 | "Display the position in the current file as an icon." | 259 | "Display the position in the current file as an icon." |
@@ -312,7 +321,8 @@ to a function in the current buffer, call that function instead." | |||
312 | +modeline-position-function | 321 | +modeline-position-function |
313 | (+modeline-concat '(+modeline-region | 322 | (+modeline-concat '(+modeline-region |
314 | +modeline-line-column | 323 | +modeline-line-column |
315 | +modeline-file-percentage))))) | 324 | ;; +modeline-file-percentage |
325 | ))))) | ||
316 | 326 | ||
317 | (defun +modeline-vc (&optional spacer) | 327 | (defun +modeline-vc (&optional spacer) |
318 | "Display the version control branch of the current buffer in the modeline." | 328 | "Display the version control branch of the current buffer in the modeline." |
diff --git a/lisp/acdw.el b/lisp/acdw.el index 171a109..6707e76 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -107,8 +107,7 @@ on buffers derived from one of the modes in PREDICATE." | |||
107 | (let ((pred (or predicate t))) | 107 | (let ((pred (or predicate t))) |
108 | (dolist (buf (buffer-list)) | 108 | (dolist (buf (buffer-list)) |
109 | (with-current-buffer buf | 109 | (with-current-buffer buf |
110 | (when (cond ((or (eq (car-safe pred) 'closure) | 110 | (when (cond ((functionp pred) |
111 | (fboundp pred)) | ||
112 | (funcall pred)) | 111 | (funcall pred)) |
113 | ((listp pred) | 112 | ((listp pred) |
114 | (apply #'derived-mode-p pred)) | 113 | (apply #'derived-mode-p pred)) |