about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.org180
1 files changed, 110 insertions, 70 deletions
diff --git a/config.org b/config.org index 5aae931..288665b 100644 --- a/config.org +++ b/config.org
@@ -192,7 +192,7 @@ Let's try settings from [[https://github.com/nex3/perspective-el#some-musings-on
192*** Switch to other window or buffer :crux: 192*** Switch to other window or buffer :crux:
193 193
194#+begin_src emacs-lisp :noweb-ref bindings 194#+begin_src emacs-lisp :noweb-ref bindings
195 (define-key acdw/map (kbd "M-o") #'crux-other-window-or-switch-buffer) 195 (acdw/bind "M-o" #'crux-other-window-or-switch-buffer)
196#+end_src 196#+end_src
197 197
198*** The *Help* window 198*** The *Help* window
@@ -269,7 +269,7 @@ someday.
269#+end_src 269#+end_src
270 270
271#+begin_src emacs-lisp :noweb-ref bindings 271#+begin_src emacs-lisp :noweb-ref bindings
272 (define-key acdw/leader (kbd "C-x") #'scratch) 272 (acdw/bind "C-x" #'scratch :map acdw/leader)
273#+end_src 273#+end_src
274 274
275*** Kill buffers better 275*** Kill buffers better
@@ -294,7 +294,7 @@ someday.
294#+end_src 294#+end_src
295 295
296#+begin_src emacs-lisp :noweb-ref bindings 296#+begin_src emacs-lisp :noweb-ref bindings
297 (define-key acdw/map (kbd "C-x k") #'kill-a-buffer) 297 (acdw/bind "C-x k" #'kill-a-buffer)
298#+end_src 298#+end_src
299 299
300*** Kill old buffers after a while 300*** Kill old buffers after a while
@@ -953,19 +953,15 @@ Let's have =prescient= and =selectrum= work together.
953#+end_src 953#+end_src
954 954
955#+begin_src emacs-lisp :noweb-ref bindings 955#+begin_src emacs-lisp :noweb-ref bindings
956 (with-eval-after-load 'icomplete 956 (acdw/bind-after-map 'icomplete icomplete-minibuffer-map
957 (define-key icomplete-minibuffer-map (kbd "<down>") 957 (("<down>" #'icomplete-forward-completions)
958 #'icomplete-forward-completions) 958 ("C-n" #'icomplete-forward-completions)
959 (define-key icomplete-minibuffer-map (kbd "C-n") 959 ("<up>" #'icomplete-backward-completions)
960 #'icomplete-forward-completions) 960 ("C-p" #'icomplete-backward-completions)))
961 (define-key icomplete-minibuffer-map (kbd "<up>")
962 #'icomplete-backward-completions)
963 (define-key icomplete-minibuffer-map (kbd "C-p")
964 #'icomplete-backward-completions))
965 961
966 (with-eval-after-load 'icomplete-vertical 962 (acdw/bind "C-v" #'icomplete-vertical-toggle
967 (define-key icomplete-minibuffer-map (kbd "C-v") 963 :after 'icomplete-vertical
968 #'icomplete-vertical-toggle)) 964 :map icomplete-minibuffer-map)
969#+end_src 965#+end_src
970 966
971#+begin_src emacs-lisp :noweb-ref modes 967#+begin_src emacs-lisp :noweb-ref modes
@@ -997,39 +993,39 @@ Consult has a lot of great bindings that work well with Emacs's
997default completion system. These all come from the [[https://github.com/minad/consult#configuration][example configuration]]. 993default completion system. These all come from the [[https://github.com/minad/consult#configuration][example configuration]].
998 994
999#+begin_src emacs-lisp :noweb-ref bindings 995#+begin_src emacs-lisp :noweb-ref bindings
1000 (with-eval-after-load 'consult 996 (acdw/bind-after-map 'consult acdw/map
1001 ;; C-c bindings (`mode-specific-map') 997 ;; C-c bindings (`mode-specific-map')
1002 (define-key acdw/map (kbd "C-c h") #'consult-history) 998 (("C-c h" #'consult-history)
1003 (define-key acdw/map (kbd "C-c m") #'consult-mode-command) 999 ("C-c m" #'consult-mode-command)
1004 ;; C-x bindings (`ctl-x-map') 1000 ;; C-x bindings (`ctl-x-map')
1005 (define-key acdw/map (kbd "C-x M-:") #'consult-complex-command) 1001 ("C-x M-:" #'consult-complex-command)
1006 (define-key acdw/map (kbd "C-x b") #'consult-buffer) 1002 ("C-x b" #'consult-buffer)
1007 (define-key acdw/map (kbd "C-x 4 b") #'consult-buffer-other-window) 1003 ("C-x 4 b" #'consult-buffer-other-window)
1008 (define-key acdw/map (kbd "C-x 5 b") #'consult-buffer-other-frame) 1004 ("C-x 5 b" #'consult-buffer-other-frame)
1009 (define-key acdw/map (kbd "C-x r x") #'consult-register) 1005 ("C-x r x" #'consult-register)
1010 (define-key acdw/map (kbd "C-x r b") #'consult-bookmark) 1006 ("C-x r b" #'consult-bookmark)
1011 ;; M-g bindings (`goto-map') 1007 ;; M-g bindings (`goto-map')
1012 (define-key acdw/map (kbd "M-g g") #'consult-line) 1008 ("M-g g" #'consult-line)
1013 (define-key acdw/map (kbd "M-g M-g") #'consult-line) 1009 ("M-g M-g" #'consult-line)
1014 (define-key acdw/map (kbd "M-g o") #'consult-outline) 1010 ("M-g o" #'consult-outline)
1015 (define-key acdw/map (kbd "M-g m") #'consult-mark) 1011 ("M-g m" #'consult-mark)
1016 (define-key acdw/map (kbd "M-g k") #'consult-global-mark) 1012 ("M-g k" #'consult-global-mark)
1017 (define-key acdw/map (kbd "M-g i") #'consult-imenu) 1013 ("M-g i" #'consult-imenu)
1018 (define-key acdw/map (kbd "M-g e") #'consult-error) 1014 ("M-g e" #'consult-error)
1019 ;; M-s bindings (`search-map') 1015 ;; M-s bindings (`search-map')
1020 (define-key acdw/map (kbd "M-s g") #'consult-grep) ; alts: 1016 ("M-s g" #'consult-grep) ; alts:
1021 ; consult-git-grep, 1017 ; consult-git-grep,
1022 ; consult-ripgrep 1018 ; consult-ripgrep
1023 (define-key acdw/map (kbd "M-s f") #'consult-find) ; alts: 1019 ("M-s f" #'consult-find) ; alts:
1024 ; consult-locate 1020 ; consult-locate
1025 (define-key acdw/map (kbd "M-s l") #'consult-line) 1021 ("M-s l" #'consult-line)
1026 (define-key acdw/map (kbd "M-s m") #'consult-multi-occur) 1022 ("M-s m" #'consult-multi-occur)
1027 (define-key acdw/map (kbd "M-s k") #'consult-keep-lines) 1023 ("M-s k" #'consult-keep-lines)
1028 (define-key acdw/map (kbd "M-s u") #'consult-focus-lines) 1024 ("M-s u" #'consult-focus-lines)
1029 ;; Other bindings 1025 ;; Other bindings
1030 (define-key acdw/map (kbd "M-y") #'consult-yank-pop) 1026 ("M-y" #'consult-yank-pop)
1031 (define-key acdw/map (kbd "<f1> a") #'consult-apropos) 1027 ("<f1> a" #'consult-apropos)
1032 (define-key acdw/map (kbd "C-h a") #'consult-apropos)) 1028 ("C-h a" #'consult-apropos)))
1033#+end_src 1029#+end_src
1034 1030
1035#+begin_src emacs-lisp :noweb-ref settings 1031#+begin_src emacs-lisp :noweb-ref settings
@@ -1084,7 +1080,7 @@ Before I install any completion framework, I want a good default for
1084completing. =hippie-expand= fills that niche. 1080completing. =hippie-expand= fills that niche.
1085 1081
1086#+begin_src emacs-lisp :noweb-ref bindings 1082#+begin_src emacs-lisp :noweb-ref bindings
1087 (define-key acdw/map (kbd "M-/") #'hippie-expand) 1083 (acdw/bind "M-/" #'hippie-expand)
1088#+end_src 1084#+end_src
1089 1085
1090** Bindings 1086** Bindings
@@ -1113,6 +1109,49 @@ on as I please.
1113 (blackout 'acdw/mode) 1109 (blackout 'acdw/mode)
1114#+end_src 1110#+end_src
1115 1111
1112*** =acdw/bind= macro
1113
1114Since defining keys can be a chore, I've written this macro to make it just a
1115/little/ bit easier. It's /not/ as comprehensive as =bind-key=, but it's just a
1116little sugar on top of =define-key= et al.
1117
1118#+begin_src emacs-lisp :noweb-ref functions
1119 (defmacro acdw/bind (key def &rest args)
1120 "A simple key-binding macro that takes care of the annoying stuff.
1121
1122 If KEY is a vector, it's passed directly to `define-key',
1123 otherwise it wraps it in `kbd'. It does NOT quote any
1124 definitions, because I like to keep those explicit in the
1125 definitions.
1126
1127 The following keywords are recognized:
1128
1129 :after PACKAGE-OR-FEATURE .. wrap key definition in `with-eval-after-load'
1130 :map KEYMAP .. define key in KEYMAP instead of `acdw/map'"
1131 (let* ((after (plist-get args :after))
1132 (map (or (plist-get args :map) 'acdw/map))
1133 (key (if (vectorp key) key `(kbd ,key)))
1134 (def-key `(define-key ,map ,key ,def)))
1135 (if after
1136 `(with-eval-after-load ,after
1137 ,def-key)
1138 def-key)))
1139
1140 (defmacro acdw/bind-after-map (feature keymap bindings)
1141 "Wrap multiple calls to `acdw/bind' in a `with-eval-after-load' form.
1142
1143 FEATURE is the argument to `with-eval-after-load'. KEYMAP is
1144 passed to the `:map' argument of `acdw/bind', if it's non-nil."
1145 (declare (indent 2))
1146 (let (bind-list)
1147 (dolist (bind bindings bind-list)
1148 (if keymap
1149 (push `(acdw/bind ,@bind :map ,keymap) bind-list)
1150 (push `(acdw/bind ,@bind) bind-list)))
1151 `(with-eval-after-load ,feature
1152 ,@bind-list)))
1153#+end_src
1154
1116**** Turn off acdw/mode in the minibuffer 1155**** Turn off acdw/mode in the minibuffer
1117 1156
1118#+begin_src emacs-lisp :noweb-ref acdw-mode 1157#+begin_src emacs-lisp :noweb-ref acdw-mode
@@ -1489,7 +1528,7 @@ that I /literally/ never use. So I'm going to bind it to =find-file= ... since
1489that's the only time I accidentally call it, anyway. 1528that's the only time I accidentally call it, anyway.
1490 1529
1491#+begin_src emacs-lisp :noweb-ref bindings 1530#+begin_src emacs-lisp :noweb-ref bindings
1492 (define-key acdw/map (kbd "C-x f") #'find-file) 1531 (acdw/bind "C-x f" #'find-file)
1493#+end_src 1532#+end_src
1494 1533
1495*** Auto-fill vs. Visual-line 1534*** Auto-fill vs. Visual-line
@@ -1646,7 +1685,7 @@ see also
1646#+end_src 1685#+end_src
1647 1686
1648#+begin_src emacs-lisp :noweb-ref bindings 1687#+begin_src emacs-lisp :noweb-ref bindings
1649 (define-key acdw/map (kbd "C-=") #'er/expand-region) 1688 (acdw/bind "C-=" #'er/expand-region)
1650#+end_src 1689#+end_src
1651 1690
1652*** Pulse the modified region with goggles 1691*** Pulse the modified region with goggles
@@ -1674,8 +1713,8 @@ see also
1674#+end_src 1713#+end_src
1675 1714
1676#+begin_src emacs-lisp :noweb-ref bindings 1715#+begin_src emacs-lisp :noweb-ref bindings
1677 (define-key acdw/map (kbd "C-/") #'undo-fu-only-undo) 1716 (acdw/bind "C-/" #'undo-fu-only-undo)
1678 (define-key acdw/map (kbd "C-?") #'undo-fu-only-redo) 1717 (acdw/bind "C-?" #'undo-fu-only-redo)
1679#+end_src 1718#+end_src
1680 1719
1681*** Undo Fu session 1720*** Undo Fu session
@@ -1755,13 +1794,13 @@ I've switched =query-replace= and =query-replace-regexp= with their anzu
1755versions, because of the regex thing. 1794versions, because of the regex thing.
1756 1795
1757#+begin_src emacs-lisp :noweb-ref bindings 1796#+begin_src emacs-lisp :noweb-ref bindings
1758 (define-key acdw/map [remap query-replace] #'anzu-query-replace-regexp) 1797 (acdw/bind-after-map 'anzu nil
1759 (define-key acdw/map [remap query-replace-regexp] #'anzu-query-replace) 1798 (([remap query-replace] #'anzu-query-replace-regexp)
1760 1799 ([remap query-replace-regexp] #'anzu-query-replace)
1761 (define-key isearch-mode-map [remap isearch-query-replace] 1800 ([remap isearch-query-replace] #'anzu-isearch-query-replace
1762 #'anzu-isearch-query-replace) 1801 :map isearch-mode-map)
1763 (define-key isearch-mode-map [remap isearch-query-replace-regexp] 1802 ([remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp
1764 #'anzu-isearch-query-replace-regexp) 1803 :map isearch-mode-map)))
1765#+end_src 1804#+end_src
1766 1805
1767** Commenting :crux: 1806** Commenting :crux:
@@ -1775,7 +1814,7 @@ already commented. That's it.
1775#+end_src 1814#+end_src
1776 1815
1777#+begin_src emacs-lisp :noweb-ref bindings 1816#+begin_src emacs-lisp :noweb-ref bindings
1778 (define-key acdw/map (kbd "M-;") #'comment-or-uncomment-region) 1817 (acdw/bind "M-;" #'comment-or-uncomment-region)
1779#+end_src 1818#+end_src
1780 1819
1781** Goto address mode 1820** Goto address mode
@@ -1816,7 +1855,7 @@ I just found out that =M-== counts the words in a region. That's great, but I
1816often want to count the words in the whole buffer. 1855often want to count the words in the whole buffer.
1817 1856
1818#+begin_src emacs-lisp :noweb-ref bindings 1857#+begin_src emacs-lisp :noweb-ref bindings
1819 (define-key acdw/map (kbd "M-=") #'count-words) 1858 (acdw/bind "M-=" #'count-words)
1820#+end_src 1859#+end_src
1821 1860
1822** Spell checking 1861** Spell checking
@@ -1857,8 +1896,9 @@ Display corrections with =completing-read=.
1857#+end_src 1896#+end_src
1858 1897
1859#+begin_src emacs-lisp :noweb-ref bindings 1898#+begin_src emacs-lisp :noweb-ref bindings
1860 (with-eval-after-load 'flyspell 1899 (acdw/bind "C-;" #'flyspell-correct-wrapper
1861 (define-key flyspell-mode-map (kbd "C-;") #'flyspell-correct-wrapper)) 1900 :after 'flyspell
1901 :map flyspell-mode-map)
1862#+end_src 1902#+end_src
1863 1903
1864* Reading 1904* Reading
@@ -2152,7 +2192,7 @@ move up a directory with a keybinding, I'll change =-a= to =-A=.
2152#+end_src 2192#+end_src
2153 2193
2154#+begin_src emacs-lisp :noweb-ref bindings 2194#+begin_src emacs-lisp :noweb-ref bindings
2155 (define-key acdw/map (kbd "C-x C-j") #'dired-jump) 2195 (acdw/bind "C-x C-j" #'dired-jump)
2156#+end_src 2196#+end_src
2157 2197
2158*** Expand subtrees :package: 2198*** Expand subtrees :package:
@@ -2165,8 +2205,7 @@ enables me to open them in the same buffer, fancily indented.
2165#+end_src 2205#+end_src
2166 2206
2167#+begin_src emacs-lisp :noweb-ref bindings 2207#+begin_src emacs-lisp :noweb-ref bindings
2168 (with-eval-after-load 'dired 2208 (acdw/bind "i" #'dired-subtree-toggle :after 'dired :map dired-mode-map)
2169 (define-key dired-mode-map "i" #'dired-subtree-toggle))
2170#+end_src 2209#+end_src
2171 2210
2172*** Collapse singleton directories :package: 2211*** Collapse singleton directories :package:
@@ -2191,7 +2230,7 @@ that one item is.
2191#+end_src 2230#+end_src
2192 2231
2193#+begin_src emacs-lisp :noweb-ref bindings 2232#+begin_src emacs-lisp :noweb-ref bindings
2194 (define-key acdw/leader "g" #'magit-status) 2233 (acdw/bind "g" #'magit-status :map acdw/leader)
2195#+end_src 2234#+end_src
2196 2235
2197**** Windows setup 2236**** Windows setup
@@ -2328,7 +2367,7 @@ See [[https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/mast
2328#+end_src 2367#+end_src
2329 2368
2330#+begin_src emacs-lisp :noweb-ref bindings 2369#+begin_src emacs-lisp :noweb-ref bindings
2331 (define-key acdw/leader "f" #'elfeed) 2370 (acdw/bind "f" #'elfeed :map acdw/leader)
2332#+end_src 2371#+end_src
2333 2372
2334**** Elfeed feeds 2373**** Elfeed feeds
@@ -2336,6 +2375,7 @@ See [[https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/mast
2336#+begin_src emacs-lisp :noweb-ref settings 2375#+begin_src emacs-lisp :noweb-ref settings
2337 (setq elfeed-feeds 2376 (setq elfeed-feeds
2338 `( 2377 `(
2378 ("https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/4315588" weather)
2339 ("https://xfnw.tilde.institute/sandcats/feed.rss" fwend pix) 2379 ("https://xfnw.tilde.institute/sandcats/feed.rss" fwend pix)
2340 ("https://www.makeworld.gq/feed.xml" blag) 2380 ("https://www.makeworld.gq/feed.xml" blag)
2341 ("https://whyarentyoucoding.com/feed.xml" comix) 2381 ("https://whyarentyoucoding.com/feed.xml" comix)
@@ -2529,11 +2569,11 @@ others.
2529#+end_src 2569#+end_src
2530 2570
2531#+begin_src emacs-lisp :noweb-ref bindings 2571#+begin_src emacs-lisp :noweb-ref bindings
2532 (with-eval-after-load 'elpher 2572 (acdw/bind-after-map 'elpher elpher-mode-map
2533 (define-key elpher-mode-map "n" #'elpher-next-link) 2573 (("n" #'elpher-next-link)
2534 (define-key elpher-mode-map "p" #'elpher-prev-link) 2574 ("p" #'elpher-prev-link)
2535 (define-key elpher-mode-map "o" #'elpher-follow-current-link) 2575 ("o" #'elpher-follow-current-link)
2536 (define-key elpher-mode-map "G" #'elpher-go-current)) 2576 ("G" #'elpher-go-current)))
2537#+end_src 2577#+end_src
2538 2578
2539#+begin_src emacs-lisp :noweb-ref hooks 2579#+begin_src emacs-lisp :noweb-ref hooks