summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-09-26 17:18:04 -0500
committerCase Duckworth2021-09-26 17:18:04 -0500
commitfc75e6078df18181b2b389a7efd244c417b0e8a1 (patch)
tree162df94fedcc11fd02b03d5e6e49019ac15bc2f0 /init.el
parentwhitespace (diff)
parentResort (diff)
downloademacs-fc75e6078df18181b2b389a7efd244c417b0e8a1.tar.gz
emacs-fc75e6078df18181b2b389a7efd244c417b0e8a1.zip
Merge branch 'main' of tildegit.org:acdw/emacs
Diffstat (limited to 'init.el')
-rw-r--r--init.el553
1 files changed, 264 insertions, 289 deletions
diff --git a/init.el b/init.el index 14c85ce..8cad956 100644 --- a/init.el +++ b/init.el
@@ -1,6 +1,6 @@
1;;; init.el -*- lexical-binding: t; coding: utf-8-unix -*- 1;;; init.el -*- lexical-binding: t; coding: utf-8-unix -*-
2 2
3;; Author: Case Duckworth <acdw@acdw.net> 3;; Author: Case Duckworth <(rot13-string "npqj@npqj.arg")>
4;; Created: Sometime during Covid-19, 2020 4;; Created: Sometime during Covid-19, 2020
5;; Keywords: configuration 5;; Keywords: configuration
6;; URL: https://tildegit.org/acdw/emacs 6;; URL: https://tildegit.org/acdw/emacs
@@ -13,12 +13,14 @@
13;; Everyone is permitted to do whatever with this software, without 13;; Everyone is permitted to do whatever with this software, without
14;; limitation. This software comes without any warranty whatsoever, 14;; limitation. This software comes without any warranty whatsoever,
15;; but with two pieces of advice: 15;; but with two pieces of advice:
16;; - Don't hurt yourself. 16;; - Be kind to yourself.
17;; - Make good choices. 17;; - Make good choices.
18 18
19;;; Code: 19;;; Commentary:
20
21;; Some of the names in these `setup' forms are arbitrary.
20 22
21;; NOTE that some of the names in `setup' forms are arbitrary. 23;;; Code:
22 24
23(setup (:require auth-source) 25(setup (:require auth-source)
24 (:option auth-sources (list (acdw/sync-dir "authinfo") 26 (:option auth-sources (list (acdw/sync-dir "authinfo")
@@ -79,7 +81,7 @@
79 (acdw/require-private) 81 (acdw/require-private)
80 82
81 (:option user-full-name "Case Duckworth" 83 (:option user-full-name "Case Duckworth"
82 user-mail-address "acdw@acdw.net") 84 user-mail-address (rot13-string "npqj@npqj.arg"))
83 85
84 (when-let ((default-directory 86 (when-let ((default-directory
85 (expand-file-name-exists-p "pkg/" user-emacs-directory))) 87 (expand-file-name-exists-p "pkg/" user-emacs-directory)))
@@ -92,26 +94,25 @@ In short, DO NOT USE THIS FUNCTION!!!"
92 (save-excursion 94 (save-excursion
93 (sort-sexps 95 (sort-sexps
94 (point-min) (point-max) 96 (point-min) (point-max)
95 (lambda (sexp) 97 ;; Key function
96 (format "%S" (cadr sexp))) 98 nil
99 ;; Sort function
97 (lambda (s1 s2) ; oh god, this is worse. 100 (lambda (s1 s2) ; oh god, this is worse.
98 (let* ((s1 (cdr s1)) (s2 (cdr s2)) ; for the strings themselves 101 (let* ((s1 (cdr s1)) (s2 (cdr s2)) ; for the strings themselves
99 (s1-require (string-match ":require" s1)) 102 (require-regexp (rx bos (* nonl) ":require"))
100 (s2-require (string-match ":require" s2)) 103 (straight-regexp (rx bos (* nonl) ":straight"))
101 (s1-straight (string-match ":straight" s1)) 104 (s1-require (string-match require-regexp s1))
102 (s2-straight (string-match ":straight" s2)) 105 (s2-require (string-match require-regexp s2))
106 (s1-straight (string-match straight-regexp s1))
107 (s2-straight (string-match straight-regexp s2))
103 (s1-bare (not (or s1-require s1-straight))) 108 (s1-bare (not (or s1-require s1-straight)))
104 (s2-bare (not (or s2-require s2-straight)))) 109 (s2-bare (not (or s2-require s2-straight))))
105 (cond 110 (cond
106 ;; if both are the same, sort regular style 111 ;; Straight forms require some weirdness
107 ((or (and s1-require s2-require)
108 (and s1-bare s2-bare))
109 (string< s1 s2))
110 ((and s1-straight s2-straight) 112 ((and s1-straight s2-straight)
111 (let* ((r (rx ":straight" (? "-if") (* space) (? "("))) 113 (let* ((r (rx ":straight" (? "-if") (* space) (? "(")))
112 (s1 (replace-regexp-in-string r "" s1)) 114 (s1 (replace-regexp-in-string r "" s1))
113 (s2 (replace-regexp-in-string r "" s2))) 115 (s2 (replace-regexp-in-string r "" s2)))
114 (message "'%S' '%S'" s1 s2)
115 (string< s1 s2))) 116 (string< s1 s2)))
116 ;; requires should go first 117 ;; requires should go first
117 ((and s1-require (not s2-require)) t) 118 ((and s1-require (not s2-require)) t)
@@ -185,167 +186,16 @@ In short, DO NOT USE THIS FUNCTION!!!"
185 186
186(setup buffers 187(setup buffers
187 (:global "C-x k" #'acdw/kill-a-buffer) 188 (:global "C-x k" #'acdw/kill-a-buffer)
188 (defun buffer-list-update@set-major-mode () 189 ;; Set the right major mode based on buffer name, if not visiting a file.
189 "Set `major-mode' from buffer name, even when not visiting a file." 190 ;; http://ruzkuku.com/emacs.d.html#orgeab93c3
190 (let ((name (buffer-name))) 191 (setq-default major-mode (lambda ()
191 (unless (or (active-minibuffer-window) 192 (unless buffer-file-name
192 (string-prefix-p "*" name) 193 (let ((buffer-file-name (buffer-name)))
193 (not (eq major-mode 'fundamental-mode))) 194 (set-auto-mode))))))
194 (catch 'done
195 (dolist (cell auto-mode-alist)
196 (let ((regexp (car cell))
197 (mode (cdr cell)))
198 (when (string-match regexp name)
199 (let ((major-mode mode))
200 (funcall mode))
201 (throw 'done mode))))))))
202
203 ;; TODO: more testing, just in case.
204 ;;(add-hook 'buffer-list-update-hook #'buffer-list-update@set-major-mode)
205 )
206 195
207(setup calendar 196(setup calendar
208 (:option calendar-week-start-day 1)) 197 (:option calendar-week-start-day 1))
209 198
210(setup (:straight circe)
211 (require 'circe)
212 (require 'acdw-irc)
213
214 (:option acdw-irc/left-margin 20
215 acdw-irc/post-my-nick "-> "
216 circe-channel-killed-confirmation nil
217 circe-color-nicks-everywhere t
218 circe-default-nick "acdw"
219 circe-default-part-message "See You, Space Cowpokes . . ."
220 circe-default-user "acdw"
221 circe-format-action (format
222 (format "%%%ds* {nick} {body}"
223 (- acdw-irc/left-margin 2)) " ")
224 circe-format-say (format
225 "{nick:%1$d.%1$ds} | {body}"
226 (- acdw-irc/left-margin 3))
227 circe-format-self-action circe-format-action
228 circe-format-self-say (format
229 "{nick:%1$d.%1$ds} > {body}"
230 (- acdw-irc/left-margin 3))
231 circe-network-inhibit-autoconnect '("Pissnet" "Twitch IRC")
232 circe-network-options
233 `(("Libera Chat"
234 :channels ("#emacs" "#systemcrafters" "##webpals")
235 :sasl-username ,circe-default-nick
236 :sasl-password ,(acdw/make-password-fetcher
237 :host "libera.chat"))
238 ("Tilde Chat" :host "irc.tilde.chat" :port 6697 :use-tls t
239 :channels ("#meta" "#bread" "#dadjokes" "#team"
240 "#emacs" (acdw/system (:home "#nsfw")))
241 :sasl-username ,circe-default-nick
242 :sasl-password ,(acdw/make-password-fetcher
243 :host "tilde.chat"))
244 ("Casa" :host "m455.casa" :port 6697 :use-tls t
245 :channels ("#basement")
246 :sasl-username ,circe-default-nick
247 :sasl-password ,(acdw/make-password-fetcher
248 :host "m455.casa"))
249 ("Pissnet" :host "piss.hmm.st" :port 6697 :use-tls t
250 :channels ("#i-just-peed")
251 :sasl-username ,circe-default-nick
252 :sasl-password ,(acdw/make-password-fetcher
253 :host "piss.hmm.st"))
254 ("Twitch IRC" :host "irc.chat.twitch.tv" :port 6697 :use-tls t
255 :nick "caseofducks" :user "caseofducks"
256 :pass ,(acdw/make-password-fetcher)
257 ))
258 circe-reduce-lurker-spam t
259 circe-server-auto-join-default-type :after-auth
260 circe-server-buffer-action (lambda (buf)
261 (message "Connected to %s" buf)))
262
263 (with-eval-after-load 'circe
264 (:face circe-nick-highlight-face
265 ((t (:inherit (modus-themes-hl-line modus-themes-bold))))
266 circe-my-message-face
267 ((t (:inherit (modus-themes-slant))))))
268
269 (:bind "C-c C-p" #'circe-command-PART
270 "C-l" #'lui-track-jump-to-indicator)
271
272 (:advise circe-command-PART :after
273 (defun circe-part@kill-buffer (&rest _)
274 (let ((circe-channel-killed-confirmation nil))
275 (kill-buffer)))
276
277 circe-command-QUIT :after
278 (defun circe-quit@kill-buffer (&rest _)
279 ;; `circe-server-killed-confirmation' set to nil, and manually
280 ;; deleting all chat buffers, pending Github issue #402
281 ;; (https://github.com/emacs-circe/circe/issues/402)
282 (let ((circe-server-killed-confirmation nil))
283 (with-circe-server-buffer
284 (dolist (buf (circe-server-chat-buffers))
285 (let ((circe-channel-killed-confirmation nil))
286 (kill-buffer buf)))
287 (kill-buffer))))
288
289 circe-command-GQUIT :after
290 (defun circe-gquit@kill-buffer (&rest _)
291 ;; `circe-server-killed-confirmation' set to nil, and manually
292 ;; deleting all chat buffers, pending Github issue #402
293 ;; (https://github.com/emacs-circe/circe/issues/402)
294 (let ((circe-server-killed-confirmation nil))
295 (dolist (buf (circe-server-buffers))
296 (with-current-buffer buf
297 (dolist (buf (circe-server-chat-buffers))
298 (let ((circe-channel-killed-confirmation nil))
299 (kill-buffer buf))
300 (cancel-timer 'irc-send--queue))
301 (message "%s: %s" buf circe-server-killed-confirmation)
302 (kill-buffer))))))
303
304 (defun circe-command-SHORTEN (url)
305 "Shorten URL using `0x0-shorten-uri'."
306 (interactive "sURL to shorten: ")
307 ;; TODO: enable /shorten URL comment syntax
308 (let ((short-url (0x0-shorten-uri (0x0--choose-server) url)))
309 (circe-command-SAY short-url)))
310
311 (:with-mode circe-chat-mode
312 (:hook #'acdw/stop-paren-annoyances
313 #'enable-circe-color-nicks
314 #'enable-circe-display-images
315 #'enable-circe-new-day-notifier
316 (defun circe-chat@set-prompt ()
317 (lui-set-prompt
318 (concat
319 (propertize
320 (acdw-irc/margin-format (buffer-name) "" ">")
321 'face 'circe-prompt-face
322 'read-only t
323 'intangible t
324 'cursor-intangible t)
325 " ")))))
326
327 (autoload 'circe-nick-color-reset "circe-color-nicks")
328 (add-hook 'modus-themes-after-load-theme-hook
329 #'circe-nick-color-reset)
330
331 (:with-mode lui-mode
332 (:option lui-fill-column (+ fill-column acdw-irc/left-margin)
333 lui-fill-type (repeat-string acdw-irc/left-margin " ")
334 lui-time-stamp-position 'right-margin
335 lui-time-stamp-format "%H:%M"
336 lui-track-behavior 'before-switch-to-buffer
337 lui-track-indicator 'fringe
338 lui-fill-remove-face-from-newline nil)
339
340 (:local-set fringes-outside-margins t
341 right-margin-width 5
342 scroll-margin 0
343 word-wrap t
344 wrap-prefix (repeat-string acdw-irc/left-margin " ")
345 line-number-mode nil)
346
347 (:hook #'enable-lui-track)))
348
349(setup completion 199(setup completion
350 (:option completion-ignore-case t 200 (:option completion-ignore-case t
351 read-buffer-completion-ignore-case t 201 read-buffer-completion-ignore-case t
@@ -356,6 +206,9 @@ In short, DO NOT USE THIS FUNCTION!!!"
356 206
357 (:global "M-/" #'hippie-expand)) 207 (:global "M-/" #'hippie-expand))
358 208
209(setup css-mode
210 (:bind "C-c C-h" #'css-lookup-symbol))
211
359(setup cursor 212(setup cursor
360 (:option cursor-type 'bar 213 (:option cursor-type 'bar
361 cursor-in-non-selected-windows 'hollow 214 cursor-in-non-selected-windows 'hollow
@@ -461,24 +314,6 @@ In short, DO NOT USE THIS FUNCTION!!!"
461 ;; https://oremacs.com/2015/01/17/setting-up-ediff/ 314 ;; https://oremacs.com/2015/01/17/setting-up-ediff/
462 (add-hook 'ediff-after-quit-hook-internal #'winner-undo)) 315 (add-hook 'ediff-after-quit-hook-internal #'winner-undo))
463 316
464;; requires extension:
465;; https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/
466(setup (:straight edit-server)
467 (:require edit-server)
468 (edit-server-start)
469
470 (:option edit-server-default-major-mode 'text-mode
471 edit-server-url-major-mode-alist
472 (list (cons (rx (| "reddit.com"
473 "tildes.net"))
474 'markdown-mode)
475 (cons (rx "github.com")
476 'gfm-mode)))
477
478 (:advise edit-server-make-frame :before
479 (defun edit-server@set-a-variable (&rest _)
480 (setq-local edit-server-frame-p t))))
481
482(setup eldoc 317(setup eldoc
483 (:option eldoc-idle-delay 0.1 318 (:option eldoc-idle-delay 0.1
484 eldoc-echo-area-use-multiline-p nil)) 319 eldoc-echo-area-use-multiline-p nil))
@@ -523,6 +358,8 @@ In short, DO NOT USE THIS FUNCTION!!!"
523 ;; This should stay as /minimal/ as possible. Anything that can go somewhere 358 ;; This should stay as /minimal/ as possible. Anything that can go somewhere
524 ;; else /should/ go there. 359 ;; else /should/ go there.
525 (:option 360 (:option
361 async-shell-command-display-buffer nil
362 async-shell-command-buffer #'new-buffer
526 attempt-orderly-shutdown-on-fatal-signal nil 363 attempt-orderly-shutdown-on-fatal-signal nil
527 auto-hscroll-mode 'current-line 364 auto-hscroll-mode 'current-line
528 attempt-stack-overflow-recovery nil 365 attempt-stack-overflow-recovery nil
@@ -894,6 +731,24 @@ specific to most general, they are these:
894 ;; (put 'backward-page 'repeat-map 'page-navigation-repeat-map) 731 ;; (put 'backward-page 'repeat-map 'page-navigation-repeat-map)
895 ) 732 )
896 733
734(setup prog
735 (:option show-paren-delay 0
736 show-paren-style 'mixed
737 show-paren-when-point-inside-paren t
738 show-paren-when-point-in-periphery t
739 smie-indent-basic tab-width)
740
741 (:hook show-paren-mode
742 electric-pair-local-mode
743 acdw/setup-fringes
744
745 (defun prog-mode@auto-fill ()
746 (setq-local comment-auto-fill-only-comments t)
747 (turn-on-auto-fill)))
748
749 (add-hook 'after-save-hook
750 #'executable-make-buffer-file-executable-if-script-p))
751
897(setup repeat 752(setup repeat
898 ;; new for Emacs 28! 753 ;; new for Emacs 28!
899 (:only-if (fboundp #'repeat-mode)) 754 (:only-if (fboundp #'repeat-mode))
@@ -1021,7 +876,11 @@ specific to most general, they are these:
1021 tab-width 4 876 tab-width 4
1022 backward-delete-char-untabify-method 'hungry) 877 backward-delete-char-untabify-method 'hungry)
1023 878
1024 (:global "M-SPC" #'cycle-spacing)) 879 (:global "M-SPC" #'cycle-spacing)
880 ;; http://ruzkuku.com/emacs.d.html#orgc62eb58
881 (:advise cycle-spacing :around
882 (defun cycle-spacing@newlines-by-default (old arg &rest _)
883 (funcall old (if (numberp arg) (- arg) arg)))))
1025 884
1026(setup windmove 885(setup windmove
1027 (:option windmove-wrap-around t) 886 (:option windmove-wrap-around t)
@@ -1146,12 +1005,7 @@ specific to most general, they are these:
1146 (indent-region (point-min) (point-max)))))) 1005 (indent-region (point-min) (point-max))))))
1147 1006
1148(setup (:straight async) 1007(setup (:straight async)
1149 (dired-async-mode +1) 1008 (dired-async-mode +1))
1150
1151 (:with-feature dired
1152 (:hook (defun dired@disable-dired-async-mode-line ()
1153 (autoload 'dired-async--modeline-mode "dired-async" nil t)
1154 (dired-async--modeline-mode -1)))))
1155 1009
1156(setup (:straight avy) 1010(setup (:straight avy)
1157 (:global "C-'" #'avy-goto-char-timer 1011 (:global "C-'" #'avy-goto-char-timer
@@ -1160,6 +1014,144 @@ specific to most general, they are these:
1160 (:with-feature isearch 1014 (:with-feature isearch
1161 (:bind "C-'" #'avy-isearch))) 1015 (:bind "C-'" #'avy-isearch)))
1162 1016
1017(setup (:straight circe)
1018 (require 'circe)
1019 (require 'acdw-irc)
1020
1021 (:option acdw-irc/left-margin 20
1022 acdw-irc/post-my-nick "-> "
1023 circe-channel-killed-confirmation nil
1024 circe-color-nicks-everywhere t
1025 circe-default-nick "acdw"
1026 circe-default-part-message "See You, Space Cowpokes . . ."
1027 circe-default-user "acdw"
1028 circe-format-action (format
1029 (format "%%%ds* {nick} {body}"
1030 (- acdw-irc/left-margin 2)) " ")
1031 circe-format-say (format
1032 "{nick:%1$d.%1$ds} | {body}"
1033 (- acdw-irc/left-margin 3))
1034 circe-format-self-action circe-format-action
1035 circe-format-self-say (format
1036 "{nick:%1$d.%1$ds} > {body}"
1037 (- acdw-irc/left-margin 3))
1038 circe-network-inhibit-autoconnect '("Pissnet" "Twitch IRC")
1039 circe-network-options
1040 `(("Libera Chat"
1041 :channels ("#emacs" "#systemcrafters" "##webpals")
1042 :sasl-username ,circe-default-nick
1043 :sasl-password ,(acdw/make-password-fetcher
1044 :host "libera.chat"))
1045 ("Tilde Chat" :host "irc.tilde.chat" :port 6697 :use-tls t
1046 :channels ("#meta" "#bread" "#dadjokes" "#team"
1047 "#emacs" "#nsfw")
1048 :sasl-username ,circe-default-nick
1049 :sasl-password ,(acdw/make-password-fetcher
1050 :host "tilde.chat"))
1051 ("Casa" :host "m455.casa" :port 6697 :use-tls t
1052 :channels ("#basement")
1053 :sasl-username ,circe-default-nick
1054 :sasl-password ,(acdw/make-password-fetcher
1055 :host "m455.casa"))
1056 ("Pissnet" :host "piss.hmm.st" :port 6697 :use-tls t
1057 :channels ("#i-just-peed")
1058 :sasl-username ,circe-default-nick
1059 :sasl-password ,(acdw/make-password-fetcher
1060 :host "piss.hmm.st"))
1061 ("Twitch IRC" :host "irc.chat.twitch.tv" :port 6697 :use-tls t
1062 :nick "caseofducks" :user "caseofducks"
1063 :pass ,(acdw/make-password-fetcher)))
1064 circe-reduce-lurker-spam t
1065 circe-server-auto-join-default-type :after-auth
1066 circe-server-buffer-action (lambda (buf)
1067 (message "Connected to %s" buf)))
1068
1069 (with-eval-after-load 'circe
1070 (:face circe-nick-highlight-face
1071 ((t (:inherit (modus-themes-hl-line modus-themes-bold))))
1072 circe-my-message-face
1073 ((t (:inherit (modus-themes-slant))))))
1074
1075 (:bind "C-c C-p" #'circe-command-PART
1076 "C-l" #'lui-track-jump-to-indicator)
1077
1078 (:advise circe-command-PART :after
1079 (defun circe-part@kill-buffer (&rest _)
1080 (let ((circe-channel-killed-confirmation nil))
1081 (kill-buffer)))
1082
1083 circe-command-QUIT :after
1084 (defun circe-quit@kill-buffer (&rest _)
1085 ;; `circe-server-killed-confirmation' set to nil, and manually
1086 ;; deleting all chat buffers, pending Github issue #402
1087 ;; (https://github.com/emacs-circe/circe/issues/402)
1088 (let ((circe-server-killed-confirmation nil))
1089 (with-circe-server-buffer
1090 (dolist (buf (circe-server-chat-buffers))
1091 (let ((circe-channel-killed-confirmation nil))
1092 (kill-buffer buf)))
1093 (kill-buffer))))
1094
1095 circe-command-GQUIT :after
1096 (defun circe-gquit@kill-buffer (&rest _)
1097 ;; `circe-server-killed-confirmation' set to nil, and manually
1098 ;; deleting all chat buffers, pending Github issue #402
1099 ;; (https://github.com/emacs-circe/circe/issues/402)
1100 (let ((circe-server-killed-confirmation nil))
1101 (dolist (buf (circe-server-buffers))
1102 (with-current-buffer buf
1103 (dolist (buf (circe-server-chat-buffers))
1104 (let ((circe-channel-killed-confirmation nil))
1105 (kill-buffer buf))
1106 (cancel-timer 'irc-send--queue))
1107 (message "%s: %s" buf circe-server-killed-confirmation)
1108 (kill-buffer))))))
1109
1110 (defun circe-command-SHORTEN (url)
1111 "Shorten URL using `0x0-shorten-uri'."
1112 (interactive "sURL to shorten: ")
1113 ;; TODO: enable /shorten URL comment syntax
1114 (let ((short-url (0x0-shorten-uri (0x0--choose-server) url)))
1115 (circe-command-SAY short-url)))
1116
1117 (:with-mode circe-chat-mode
1118 (:hook #'acdw/stop-paren-annoyances
1119 #'enable-circe-color-nicks
1120 #'enable-circe-display-images
1121 #'enable-circe-new-day-notifier
1122 (defun circe-chat@set-prompt ()
1123 (lui-set-prompt
1124 (concat
1125 (propertize
1126 (acdw-irc/margin-format (buffer-name) "" ">")
1127 'face 'circe-prompt-face
1128 'read-only t
1129 'intangible t
1130 'cursor-intangible t)
1131 " ")))))
1132
1133 (autoload 'circe-nick-color-reset "circe-color-nicks")
1134 (add-hook 'modus-themes-after-load-theme-hook
1135 #'circe-nick-color-reset)
1136
1137 (:with-mode lui-mode
1138 (:option lui-fill-column (+ fill-column acdw-irc/left-margin)
1139 lui-fill-type (repeat-string acdw-irc/left-margin " ")
1140 lui-time-stamp-position 'right-margin
1141 lui-time-stamp-format "%H:%M"
1142 lui-track-behavior 'before-switch-to-buffer
1143 lui-track-indicator 'fringe
1144 lui-fill-remove-face-from-newline nil)
1145
1146 (:local-set fringes-outside-margins t
1147 right-margin-width 5
1148 scroll-margin 0
1149 word-wrap t
1150 wrap-prefix (repeat-string acdw-irc/left-margin " ")
1151 line-number-mode nil)
1152
1153 (:hook #'enable-lui-track)))
1154
1163(setup (:straight (consult 1155(setup (:straight (consult
1164 :host github 1156 :host github
1165 :repo "minad/consult")) 1157 :repo "minad/consult"))
@@ -1302,8 +1294,49 @@ specific to most general, they are these:
1302 ("/" winner-undo 1294 ("/" winner-undo
1303 "?" winner-redo))) 1295 "?" winner-redo)))
1304 1296
1297(setup (:straight dictionary)
1298 (:option dictionary-use-single-buffer t)
1299
1300 (autoload 'dictionary-search "dictionary"
1301 "Ask for a word and search it in all dictionaries" t)
1302 (autoload 'dictionary-match-words "dictionary"
1303 "Ask for a word and search all matching words in the dictionaries" t)
1304 (autoload 'dictionary-lookup-definition "dictionary"
1305 "Unconditionally lookup the word at point." t)
1306 (autoload 'dictionary "dictionary"
1307 "Create a new dictionary buffer" t)
1308 (autoload 'dictionary-mouse-popup-matching-words "dictionary"
1309 "Display entries matching the word at the cursor" t)
1310 (autoload 'dictionary-popup-matching-words "dictionary"
1311 "Display entries matching the word at the point" t)
1312 (autoload 'dictionary-tooltip-mode "dictionary"
1313 "Display tooltips for the current word" t)
1314 (autoload 'global-dictionary-tooltip-mode "dictionary"
1315 "Enable/disable dictionary-tooltip-mode for all buffers" t)
1316
1317 (:with-map lookup-map
1318 (:bind "d" #'dictionary-search)))
1319
1305(setup (:straight edit-indirect)) 1320(setup (:straight edit-indirect))
1306 1321
1322;; requires extension:
1323;; https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/
1324(setup (:straight edit-server)
1325 (:require edit-server)
1326 (edit-server-start)
1327
1328 (:option edit-server-default-major-mode 'text-mode
1329 edit-server-url-major-mode-alist
1330 (list (cons (rx (| "reddit.com"
1331 "tildes.net"))
1332 'markdown-mode)
1333 (cons (rx "github.com")
1334 'gfm-mode)))
1335
1336 (:advise edit-server-make-frame :before
1337 (defun edit-server@set-a-variable (&rest _)
1338 (setq-local edit-server-frame-p t))))
1339
1307(setup (:straight (electric-cursor 1340(setup (:straight (electric-cursor
1308 :host github 1341 :host github
1309 :repo "duckwork/electric-cursor")) 1342 :repo "duckwork/electric-cursor"))
@@ -1544,7 +1577,8 @@ specific to most general, they are these:
1544 "<help> k" #'helpful-key 1577 "<help> k" #'helpful-key
1545 "<help> o" #'helpful-symbol) 1578 "<help> o" #'helpful-symbol)
1546 1579
1547 (:bind "q" #'quit-window)) 1580 ;; (:bind "q" #'quit-window)
1581 )
1548 1582
1549(setup (:straight hungry-delete) 1583(setup (:straight hungry-delete)
1550 (:option hungry-delete-chars-to-skip " \t" 1584 (:option hungry-delete-chars-to-skip " \t"
@@ -1653,7 +1687,7 @@ browser defined in `browse-url-secondary-browser-function'."
1653 (define-key lisp-interaction-mode-map (kbd "C-c e") #'macrostep-expand)) 1687 (define-key lisp-interaction-mode-map (kbd "C-c e") #'macrostep-expand))
1654 1688
1655(setup (:straight magit) 1689(setup (:straight magit)
1656 (:global "C-c g" #'magit-status) 1690 (:global "C-x g" #'magit-status)
1657 1691
1658 (:option magit-display-buffer-function 1692 (:option magit-display-buffer-function
1659 (defun magit-display-buffer-same-window (buffer) 1693 (defun magit-display-buffer-same-window (buffer)
@@ -1929,26 +1963,27 @@ the default is \"/\"."
1929(setup (:straight paredit) 1963(setup (:straight paredit)
1930 ;; I don't use paredit-splice-sexp much, and it stomps on isearch. 1964 ;; I don't use paredit-splice-sexp much, and it stomps on isearch.
1931 (:unbind "M-s") 1965 (:unbind "M-s")
1932 1966
1933 (defun paredit@setup () 1967 (:bind "DEL" #'paredit-backward-delete
1934 "Correct weirdnesses and set up paredit mode." 1968 "C-M-;" #'comment-or-uncomment-sexp
1935 (:with-map lisp-mode-shared-map 1969 "C-<backspace>" #'paredit-backward-kill-word
1936 (:bind "DEL" #'paredit-backward-delete 1970 "M-w" #'paredit-copy-as-kill)
1937 "C-M-;" #'comment-or-uncomment-sexp 1971
1938 "C-<backspace>" #'paredit-backward-kill-word 1972 (:hook-into emacs-lisp-mode
1939 "M-w" #'paredit-copy-as-kill)) 1973 ielm-mode sly-repl-mode
1940 (paredit-mode +1)) 1974 lisp-mode
1941 1975 lisp-interaction-mode
1942 (dolist (mode lispy-modes) 1976 scheme-mode)
1943 (add-hook (intern (format "%s-hook" mode))
1944 #'paredit@setup))
1945 1977
1946 (:also-load eldoc) 1978 (:also-load eldoc)
1947 (eldoc-add-command 'paredit-backward-delete 'paredit-close-round)) 1979 (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))
1948 1980
1949(setup (:straight paren-face) 1981(setup (:straight paren-face)
1950 (dolist (mode lispy-modes) 1982 (:hook-into emacs-lisp-mode
1951 (add-hook (intern (format "%s-hook" mode)) #'paren-face-mode))) 1983 ielm-mode sly-repl-mode
1984 lisp-mode
1985 lisp-interaction-mode
1986 scheme-mode))
1952 1987
1953(setup (:straight-if (pdf-tools 1988(setup (:straight-if (pdf-tools
1954 :host github 1989 :host github
@@ -1969,24 +2004,6 @@ the default is \"/\"."
1969 (persistent-scratch-mode +1)))) 2004 (persistent-scratch-mode +1))))
1970 (buffer-list))) 2005 (buffer-list)))
1971 2006
1972(setup prog
1973 (:option show-paren-delay 0
1974 show-paren-style 'mixed
1975 show-paren-when-point-inside-paren t
1976 show-paren-when-point-in-periphery t
1977 smie-indent-basic tab-width)
1978
1979 (:hook show-paren-mode
1980 electric-pair-local-mode
1981 acdw/setup-fringes
1982
1983 (defun prog-mode@auto-fill ()
1984 (setq-local comment-auto-fill-only-comments t)
1985 (turn-on-auto-fill)))
1986
1987 (add-hook 'after-save-hook
1988 #'executable-make-buffer-file-executable-if-script-p))
1989
1990(setup (:straight-if pkgbuild-mode 2007(setup (:straight-if pkgbuild-mode
1991 (executable-find "makepkg")) 2008 (executable-find "makepkg"))
1992 (:file-match "PKGBUILD")) 2009 (:file-match "PKGBUILD"))
@@ -1994,19 +2011,17 @@ the default is \"/\"."
1994(setup (:straight powerthesaurus) 2011(setup (:straight powerthesaurus)
1995 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim)) 2012 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim))
1996 2013
19971(setup (:straight restart-emacs) 2014(setup (:straight restart-emacs)
1998 (defun emacs-upgrade (&optional update-packages) 2015 (defun emacs-upgrade (&optional update-packages)
1999 "Pull config, upgrade packages, restart Emacs." 2016 "Pull config, upgrade packages, restart Emacs."
2000 (interactive "P") 2017 (interactive "P")
2001 (emacs-git-pull-config) 2018 (emacs-git-pull-config)
2002 (when update-packages 2019 (when update-packages
2003 (require 'straight-x) 2020 (require 'straight-x)
2004 (straight-x-pull-all)) 2021 (straight-x-pull-all))
2005 (restart-emacs))) 2022 (restart-emacs)))(setup (:straight (shell-command+
2006 2023 :host nil
2007(setup (:straight (shell-command+ 2024 :repo "https://git.sr.ht/~pkal/shell-command-plus"))
2008 :host nil
2009 :repo "https://git.sr.ht/~pkal/shell-command-plus"))
2010 (:option shell-command-prompt "$ ") 2025 (:option shell-command-prompt "$ ")
2011 (:with-feature dired 2026 (:with-feature dired
2012 (:bind "M-!" shell-command+)) 2027 (:bind "M-!" shell-command+))
@@ -2173,15 +2188,6 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2173 (:option resize-mini-windows 'grow-only 2188 (:option resize-mini-windows 'grow-only
2174 vertico-count-format nil 2189 vertico-count-format nil
2175 vertico-cycle t) 2190 vertico-cycle t)
2176
2177 ;; (:with-map vertico-map
2178 ;; (:bind "<C-backspace>"
2179 ;; (defun up-directory (arg)
2180 ;; "Move up a directory (delete backwards to /)."
2181 ;; (interactive "p")
2182 ;; (if (string-match-p "/." (minibuffer-contents))
2183 ;; (zap-up-to-char (- arg) ?/)
2184 ;; (backward-kill-word arg)))))
2185 2191
2186 (when (boundp 'native-comp-deferred-compilation-deny-list) 2192 (when (boundp 'native-comp-deferred-compilation-deny-list)
2187 (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) 2193 (add-to-list 'native-comp-deferred-compilation-deny-list "vertico"))
@@ -2196,16 +2202,7 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2196 (:bind "RET" #'vertico-directory-enter 2202 (:bind "RET" #'vertico-directory-enter
2197 "DEL" #'vertico-directory-delete-char 2203 "DEL" #'vertico-directory-delete-char
2198 "M-DEL" #'vertico-directory-delete-word)) 2204 "M-DEL" #'vertico-directory-delete-word))
2199 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) 2205 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
2200
2201 ;; Prefix the current candidate with "> ". From Vertico wiki.
2202 (:advise vertico--format-candidate :around
2203 (defun vertico-format@add-arrow (orig cand pref suf index start)
2204 (setq cand (funcall orig cand pref suf index start))
2205 (concat (if (= vertico--index index)
2206 (propertize "> " 'face 'vertico-current)
2207 " ")
2208 cand))))
2209 2206
2210(setup (:straight visual-regexp) 2207(setup (:straight visual-regexp)
2211 (:global "M-%" #'vr/query-replace)) 2208 (:global "M-%" #'vr/query-replace))
@@ -2240,7 +2237,8 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2240 (rx ".erb" eos) 2237 (rx ".erb" eos)
2241 (rx ".mustache" eos))) 2238 (rx ".mustache" eos)))
2242 2239
2243(setup (:straight wgrep)) 2240(setup (:straight wgrep)
2241 (wgrep-setup))
2244 2242
2245(setup (:straight which-key) 2243(setup (:straight which-key)
2246 (:option which-key-show-early-on-C-h t 2244 (:option which-key-show-early-on-C-h t
@@ -2294,27 +2292,4 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2294 (call-interactively #'zzz-to-char) 2292 (call-interactively #'zzz-to-char)
2295 (call-interactively #'zzz-up-to-char))))) 2293 (call-interactively #'zzz-up-to-char)))))
2296 2294
2297(setup (:straight dictionary)
2298 (:option dictionary-use-single-buffer t)
2299
2300 (autoload 'dictionary-search "dictionary"
2301 "Ask for a word and search it in all dictionaries" t)
2302 (autoload 'dictionary-match-words "dictionary"
2303 "Ask for a word and search all matching words in the dictionaries" t)
2304 (autoload 'dictionary-lookup-definition "dictionary"
2305 "Unconditionally lookup the word at point." t)
2306 (autoload 'dictionary "dictionary"
2307 "Create a new dictionary buffer" t)
2308 (autoload 'dictionary-mouse-popup-matching-words "dictionary"
2309 "Display entries matching the word at the cursor" t)
2310 (autoload 'dictionary-popup-matching-words "dictionary"
2311 "Display entries matching the word at the point" t)
2312 (autoload 'dictionary-tooltip-mode "dictionary"
2313 "Display tooltips for the current word" t)
2314 (autoload 'global-dictionary-tooltip-mode "dictionary"
2315 "Enable/disable dictionary-tooltip-mode for all buffers" t)
2316
2317 (:with-map lookup-map
2318 (:bind "d" #'dictionary-search)))
2319
2320;;; init.el ends here 2295;;; init.el ends here