summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--early-init.el9
-rw-r--r--init.el1104
-rw-r--r--lisp/acdw-modeline.el5
3 files changed, 527 insertions, 591 deletions
diff --git a/early-init.el b/early-init.el index 9f8e7f0..2fcee66 100644 --- a/early-init.el +++ b/early-init.el
@@ -224,7 +224,14 @@ package. This macro is not repeatable."
224 :repeatable nil 224 :repeatable nil
225 :shorthand (lambda (sexp) 225 :shorthand (lambda (sexp)
226 (let ((recipe (cadr sexp))) 226 (let ((recipe (cadr sexp)))
227 (if (consp recipe) (car recipe) recipe))))) 227 (if (consp recipe) (car recipe) recipe))))
228 ;; Hotfix
229 (setup-define :file-match
230 (lambda (pat)
231 `(add-to-list 'auto-mode-alist (cons ,pat ',(setup-get 'mode))))
232 :documentation "Associate the current mode with files that match PAT."
233 :debug '(form)
234 :repeatable t))
228 235
229;;; `no-littering' 236;;; `no-littering'
230(setup (:straight no-littering) 237(setup (:straight no-littering)
diff --git a/init.el b/init.el index 324430c..b4b692c 100644 --- a/init.el +++ b/init.el
@@ -74,7 +74,7 @@
74 (global-auto-revert-mode +1)) 74 (global-auto-revert-mode +1))
75 75
76(setup browse-url 76(setup browse-url
77 (require 'acdw-browse-url) 77 (:require acdw-browse-url)
78 78
79 (setq-default browse-url-secondary-browser-function 79 (setq-default browse-url-secondary-browser-function
80 (if (executable-find "firefox") ; prefer Firefox 80 (if (executable-find "firefox") ; prefer Firefox
@@ -116,7 +116,7 @@
116 (acdw/add-button-url-regexp-protocol "gemini")) 116 (acdw/add-button-url-regexp-protocol "gemini"))
117 117
118(setup buffers 118(setup buffers
119 (:global "C-x k" acdw/kill-a-buffer)) 119 (:global "C-x k" #'acdw/kill-a-buffer))
120 120
121(setup calendar 121(setup calendar
122 (:option calendar-week-start-day 1)) 122 (:option calendar-week-start-day 1))
@@ -129,7 +129,7 @@
129 completion-category-overrides 129 completion-category-overrides
130 '((file (styles . (partial-completion))))) 130 '((file (styles . (partial-completion)))))
131 131
132 (:global "M-/" hippie-expand)) 132 (:global "M-/" #'hippie-expand))
133 133
134(setup cursor 134(setup cursor
135 (:option cursor-type 'bar 135 (:option cursor-type 'bar
@@ -147,34 +147,43 @@
147 147
148 ;; `Custom-mode-hook' fires /before/ the widgets are built, so I have to 148 ;; `Custom-mode-hook' fires /before/ the widgets are built, so I have to
149 ;; install advice after the widgets are made. 149 ;; install advice after the widgets are made.
150 (advice-add 150 (:advise custom-buffer-create :after
151 'custom-buffer-create :after 151 (defun custom-buffer@expand-widgets (&rest _)
152 (defun custom-buffer@expand-widgets (&rest _) 152 "Expand descriptions in `Custom-mode' buffers."
153 "Expand descriptions and values of variables in `Custom-mode' buffers." 153 (interactive)
154 (interactive) 154 ;; "More/Hide" widgets (thanks alphapapa!)
155 ;; "More/Hide" widgets (thanks alphapapa!) 155 (widget-map-buttons (lambda (widget _)
156 (widget-map-buttons (lambda (widget _) 156 (pcase (widget-get widget :off)
157 (pcase (widget-get widget :off) 157 ("More" (widget-apply-action widget)))
158 ("More" (widget-apply-action widget))) 158 nil))
159 nil)) 159 ;; "Show Value" widgets (the little triangles)
160 ;; "Show Value" widgets (the little triangles) 160 (widget-map-buttons (lambda (widget _)
161 (widget-map-buttons (lambda (widget _) 161 (pcase (widget-get widget :off)
162 (pcase (widget-get widget :off) 162 ("Show Value"
163 ("Show Value" (widget-apply-action widget))) 163 (widget-apply-action widget)))
164 nil)))) 164 nil))))
165 165
166 (add-hook ; thanks u/oantolin! 166 (:with-mode Custom-mode
167 'Custom-mode-hook 167 (:hook (defun custom-mode@imenu () ; thanks u/oantolin!
168 (defun custom-mode@imenu () 168 "Build `imenu' for `Custom-mode'."
169 "Build `imenu' for `Custom-mode'." 169 (setq
170 (setq imenu-generic-expression 170 imenu-generic-expression
171 '(("Faces" "^\\(?:Show\\|Hide\\) \\(.*\\) face: \\[sample\\]" 1) 171 '(("Faces" (rx (seq bol
172 ("Variables" "^\\(?:Show Value\\|Hide\\) \\([^:\n]*\\)" 1)))))) 172 (or "Show" "Hide") " "
173 (group (zero-or-more nonl))
174 " face: [sample]"))
175 1)
176 ("Variables" (rx (seq bol
177 (or "Show Value" "Hide") " "
178 (group (zero-or-more
179 (not (any "\n:"))))))
180 1)))))))
173 181
174(setup debugger 182(setup debugger
175 (:hook visual-line-mode)) 183 (:hook visual-line-mode))
176 184
177(setup dired 185(setup dired
186 (:also-load dired-x)
178 (setq-default dired-recursive-copies 'always 187 (setq-default dired-recursive-copies 'always
179 dired-recursive-deletes 'always 188 dired-recursive-deletes 'always
180 delete-by-moving-to-trash t 189 delete-by-moving-to-trash t
@@ -190,27 +199,26 @@
190 (:hook dired-hide-details-mode 199 (:hook dired-hide-details-mode
191 hl-line-mode) 200 hl-line-mode)
192 201
193 (:global "C-x C-j" dired-jump) 202 (:global "C-x C-j" #'dired-jump)
194
195 (acdw/system
196 (:work (:straight w32-browser)
197 (autoload 'dired-w32-browser "w32-browser")
198 (:bind "RET" dired-w32-browser))
199 (:home (:straight dired-open)
200 (require 'dired-open)
201 (:bind "RET" dired-find-alternate-file)))
202 203
203 (with-eval-after-load 'dired 204 (with-eval-after-load 'dired
204 (require 'dired-x) 205 (acdw/system
206 (:work (:straight w32-browser)
207 (autoload 'dired-w32-browser "w32-browser")
208 (:bind "RET" #'dired-w32-browser))
209 (:home (:straight dired-open)
210 (require 'dired-open)
211 (:bind "RET" #'dired-find-alternate-file)))
212
205 (:straight dired-subtree) 213 (:straight dired-subtree)
206 (:bind "i" dired-subtree-toggle 214 (:bind "i" #'dired-subtree-toggle
207 "TAB" dired-subtree-cycle) 215 "TAB" #'dired-subtree-cycle)
208 216
209 (:straight dired-collapse) 217 (:straight dired-collapse)
210 (:hook dired-collapse-mode) 218 (:hook dired-collapse-mode)
211 219
212 (:straight dired-git-info) 220 (:straight dired-git-info)
213 (:bind ")" dired-git-info-mode) 221 (:bind ")" #'dired-git-info-mode)
214 222
215 (:straight trashed) 223 (:straight trashed)
216 (:option trashed-action-confirmer #'y-or-n-p))) 224 (:option trashed-action-confirmer #'y-or-n-p)))
@@ -263,8 +271,8 @@
263 cmd)))))) 271 cmd))))))
264 272
265(setup ediff 273(setup ediff
266 (:option ediff-window-setup-function 'ediff-setup-windows-plain 274 (:option ediff-window-setup-function #'ediff-setup-windows-plain
267 ediff-split-window-function 'split-window-horizontally)) 275 ediff-split-window-function #'split-window-horizontally))
268 276
269(setup eldoc 277(setup eldoc
270 (:option eldoc-idle-delay 0.1 278 (:option eldoc-idle-delay 0.1
@@ -275,31 +283,28 @@
275 eval-expression-print-level nil 283 eval-expression-print-level nil
276 lisp-indent-function #'lisp-indent-function) 284 lisp-indent-function #'lisp-indent-function)
277 285
278 (add-hook 'emacs-lisp-mode-hook #'checkdoc-minor-mode) 286 (:with-mode emacs-lisp-mode
287 (:hook #'checkdoc-minor-mode
288 #'turn-on-eldoc-mode
289
290 (defun emacs-lisp@enforce-lexical-binding ()
291 (setq-local lexical-binding t))
292
293 (defun emacs-lisp@imenu-add-setup ()
294 (add-to-list 'imenu-generic-expression
295 '("Setup"
296 "\\(^\\s-*(setup +(?\\)\\(\\_<.+\\_>\\)" 2))))
297
298 ;; Emulate slime's eval binds
299 (:bind "C-c C-c" #'eval-defun
300 "C-c C-k" #'acdw/eval-region-or-buffer
301 "C-c C-z" #'ielm))
279 302
280 (add-hook 'emacs-lisp-mode-hook
281 (defun emacs-lisp@enforce-lexical-binding ()
282 (setq-local lexical-binding t)))
283
284 (add-hook 'emacs-lisp-mode-hook
285 (defun emacs-lisp@imenu-add-setup ()
286 (add-to-list 'imenu-generic-expression
287 '("Setup"
288 "\\(^\\s-*(setup +(?\\)\\(\\_<.+\\_>\\)" 2))))
289
290 ;; Emulate slime's eval binds
291 (:with-map emacs-lisp-mode-map
292 (:bind "C-c C-c" eval-defun
293 "C-c C-k" acdw/eval-region-or-buffer
294 "C-c C-z" ielm))
295
296 (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode)
297 (add-hook 'ielm-mode-hook #'turn-on-eldoc-mode)
298
299 ;; Add advice to pulse evaluated regions 303 ;; Add advice to pulse evaluated regions
300 (define-advice eval-region (:around (fn start end &rest args) pulse-region) 304 (:advise eval-region :around
301 (pulse-momentary-highlight-region start end) 305 (defun eval-region@pulse (fn beg end &rest args)
302 (apply fn start end args))) 306 (pulse-momentary-highlight-region beg end)
307 (apply fn start end args))))
303 308
304(setup encoding 309(setup encoding
305 (:option locale-coding-system 'utf-8-unix 310 (:option locale-coding-system 'utf-8-unix
@@ -336,34 +341,28 @@
336 eshell-smart-space-goes-to-end t 341 eshell-smart-space-goes-to-end t
337 eshell-where-to-jump 'begin) 342 eshell-where-to-jump 'begin)
338 343
339 (:global "C-c s" eshell-pop-or-quit)
340
341 (defun eshell-mode@setup ()
342 "Set up `eshell' for use.
343Most customizations must go in this function since `eshell' loads
344like a dumbass."
345 ;; Define keys
346 (dolist (spec '(("C-d" . eshell-quit-or-delete-char)))
347 (define-key eshell-mode-map (kbd (car spec)) (cdr spec)))
348 ;; Fix modeline
349 (when (boundp 'simple-modeline--mode-line)
350 (setq mode-line-format '(:eval simple-modeline--mode-line)))
351 ;; Make navigating amongst prompts easier
352 (setq-local outline-regexp eshell-prompt-regexp
353 page-delimiter eshell-prompt-regexp))
354
355 (defun eshell-buffer-name () 344 (defun eshell-buffer-name ()
356 (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t)) 345 (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t))
357 346
358 (add-hook 'eshell-directory-change-hook #'eshell-buffer-name) 347 (add-hook 'eshell-directory-change-hook #'eshell-buffer-name)
359 (add-hook 'eshell-prompt-load-hook #'eshell-buffer-name) 348 (add-hook 'eshell-prompt-load-hook #'eshell-buffer-name)
360 349
361 (:hook eshell-mode@setup 350 (:hook eshell-arg-hist-mode
362 eshell-arg-hist-mode)) 351 (defun eshell-mode@setup ()
352 ;; Define keys
353 (dolist (spec '(("C-d" . eshell-quit-or-delete-char)))
354 (define-key eshell-mode-map (kbd (car spec)) (cdr spec)))
355 ;; Fix modeline
356 (when (boundp 'simple-modeline--mode-line)
357 (setq mode-line-format '(:eval simple-modeline--mode-line)))
358 ;; Make navigating amongst prompts easier
359 (setq-local outline-regexp eshell-prompt-regexp
360 page-delimiter eshell-prompt-regexp))))
363 361
364(setup eww 362(setup eww
365 (:option eww-search-prefix "https://duckduckgo.com/html?q=" 363 (:option eww-search-prefix "https://duckduckgo.com/html?q="
366 url-privacy-level '(email agent cookies lastloc)) 364 url-privacy-level '(email agent cookies lastloc))
365
367 (:hook acdw/reading-mode)) 366 (:hook acdw/reading-mode))
368 367
369(setup files 368(setup files
@@ -381,8 +380,6 @@ like a dumbass."
381 vc-make-backup-files t 380 vc-make-backup-files t
382 version-control t) 381 version-control t)
383 382
384 (:global "C-c i" acdw/find-emacs-dotfiles)
385
386 (auto-save-visited-mode +1) 383 (auto-save-visited-mode +1)
387 384
388 (add-hook 'unfocused-hook 385 (add-hook 'unfocused-hook
@@ -404,18 +401,16 @@ like a dumbass."
404 401
405 (add-hook 'unfocused-hook #'garbage-collect)) 402 (add-hook 'unfocused-hook #'garbage-collect))
406 403
407(setup gnus
408 (:option gnus-home-directory (acdw/dir "gnus" t)
409 gnus-directory (acdw/dir "News" t)
410 gnus-init-file (expand-file-name "gnus.el" user-emacs-directory))
411 (:global "C-c n" gnus))
412
413(setup goto-addr 404(setup goto-addr
414 (add-hook 'after-change-major-mode-hook #'goto-address-mode)) 405 (if (fboundp #'global-goto-address-mode)
406 (global-goto-address-mode)
407 (add-hook 'after-change-major-mode-hook #'goto-address-mode)))
415 408
416(setup ibuffer 409(setup ibuffer
417 (:also-load ibuf-ext) 410 (:also-load ibuf-ext)
418 (:option ibuffer-saved-filter-groups 411 (:option ibuffer-expert t
412 ibuffer-show-empty-filter-groups nil
413 ibuffer-saved-filter-groups
419 '(("default" 414 '(("default"
420 ("dired" (mode . dired-mode)) 415 ("dired" (mode . dired-mode))
421 ("customize" (mode . Custom-mode)) 416 ("customize" (mode . Custom-mode))
@@ -447,14 +442,13 @@ like a dumbass."
447 (mode . gemini-mode) 442 (mode . gemini-mode)
448 (mode . eww-mode)))))) 443 (mode . eww-mode))))))
449 444
450 (global-set-key (kbd "C-x C-b") #'ibuffer) 445 (:global "C-x C-b" #'ibuffer)
451 446
452 (add-hook 'ibuffer-mode-hook 447 (:hook (defun ibuffer@filter-to-default ()
453 (defun ibuffer@filter-to-default () 448 (ibuffer-switch-to-saved-filter-groups "default"))))
454 (ibuffer-switch-to-saved-filter-groups "default"))) 449
455 450(setup ielm
456 (:option ibuffer-show-empty-filter-groups nil 451 (:hook #'turn-on-eldoc-mode))
457 ibuffer-expert t))
458 452
459(setup imenu 453(setup imenu
460 (:option imenu-auto-rescan t)) 454 (:option imenu-auto-rescan t))
@@ -478,11 +472,12 @@ like a dumbass."
478 ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'. 472 ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'.
479 ;; I can't simply advise `kill-line' with an override from crux because crux 473 ;; I can't simply advise `kill-line' with an override from crux because crux
480 ;; itself calls `kill-line', leading to a infinite nesting situation. 474 ;; itself calls `kill-line', leading to a infinite nesting situation.
481 (define-advice kill-line (:around (fn &rest args) join-killed-line) 475 (advice-add 'kill-line :around
482 (if (and (eolp) 476 (defun kill-line@join (fn &rest args)
483 (not (bolp))) 477 (if (and (eolp)
484 (delete-indentation 1) 478 (not (bolp)))
485 (apply fn args)))) 479 (delete-indentation 1)
480 (apply fn args)))))
486 481
487(setup minibuffer 482(setup minibuffer
488 (:option enable-recursive-minibuffers t 483 (:option enable-recursive-minibuffers t
@@ -505,7 +500,6 @@ like a dumbass."
505 (fset 'yes-or-no-p #'y-or-n-p)) 500 (fset 'yes-or-no-p #'y-or-n-p))
506 501
507(setup page 502(setup page
508
509 (:option page-delimiter 503 (:option page-delimiter
510 (rx bol (or "\f" ";;;") 504 (rx bol (or "\f" ";;;")
511 (not (any "#")) (* not-newline) "\n" 505 (not (any "#")) (* not-newline) "\n"
@@ -534,61 +528,29 @@ like a dumbass."
534 (put 'backward-page 'repeat-map 'page-navigation-repeat-map)) 528 (put 'backward-page 'repeat-map 'page-navigation-repeat-map))
535 529
536(setup prog 530(setup prog
537 (:option smie-indent-basic tab-width)
538
539 (add-hook 'prog-mode-hook
540 (defun prog-mode@auto-fill ()
541 (setq-local comment-auto-fill-only-comments t)
542 ;; (advice-add 'do-auto-fill :after
543 ;; (defun auto-fill@set-comment-column (&rest _)
544 ;; (save-excursion
545 ;; (when (or (looking-back comment-start-skip)
546 ;; (progn (backward-word)
547 ;; (looking-back
548 ;; comment-start-skip)))
549 ;; (comment-set-column t)))))
550 ;; If the above advice is enabled, the below advice also needs to
551 ;; be set to make `comment-dwim' work... I think.
552 ;; (advice-add 'comment-dwim :before
553 ;; (defun comment-dwim@set-comment-column (&rest _)
554 ;; (setq comment-column 0)))
555 (turn-on-auto-fill)))
556
557 (:option show-paren-delay 0 531 (:option show-paren-delay 0
558 show-paren-style 'mixed 532 show-paren-style 'mixed
559 show-paren-when-point-inside-paren t 533 show-paren-when-point-inside-paren t
560 show-paren-when-point-in-periphery t) 534 show-paren-when-point-in-periphery t
561 535 smie-indent-basic tab-width)
562 (defun flymake-mode-except ()
563 "Turn on flymake mode, except in some modes."
564 (let ((no-flymake-modes '(emacs-lisp-mode)))
565 (unless (or (member major-mode no-flymake-modes)
566 (apply #'derived-mode-p no-flymake-modes))
567 (flymake-mode-on))))
568 536
569 (:hook show-paren-mode 537 (:hook show-paren-mode
570 electric-pair-local-mode 538 electric-pair-local-mode
571 flymake-mode-except 539 acdw/setup-fringes
572 acdw/setup-fringes)
573 540
574 (add-hook 'after-save-hook 541 (defun flymake-mode-except ()
575 #'executable-make-buffer-file-executable-if-script-p)) 542 "Turn on flymake mode, except in some modes."
576 543 (let ((no-flymake-modes '(emacs-lisp-mode)))
577;; (setup re-builder 544 (unless (or (member major-mode no-flymake-modes)
578;; (require 'acdw-re) 545 (apply #'derived-mode-p no-flymake-modes))
579;; (advice-add 're-builder :before #'acdw/re-builder-save-state) 546 (flymake-mode-on))))
580
581;; (add-hook 'reb-mode-hook #'paredit-mode)
582 547
583;; (:global "<f2>" re-builder) 548 (defun prog-mode@auto-fill ()
549 (setq-local comment-auto-fill-only-comments t)
550 (turn-on-auto-fill)))
584 551
585;; (dolist (map '(reb-mode-map reb-lisp-mode-map)) 552 (add-hook 'after-save-hook
586;; (let ((setup-map map)) 553 #'executable-make-buffer-file-executable-if-script-p))
587;; (:bind "RET" reb-replace-regexp
588;; "M-n" reb-next-match
589;; "M-p" reb-prev-match
590;; "C-g" reb-quit
591;; "C-c C-k" reb-quit))))
592 554
593(setup repeat 555(setup repeat
594 ;; new for Emacs 28! 556 ;; new for Emacs 28!
@@ -697,9 +659,8 @@ like a dumbass."
697(setup view 659(setup view
698 (:option view-read-only t) 660 (:option view-read-only t)
699 661
700 (add-hook 'view-mode-hook 662 (:hook (defun acdw/read-view-mode ()
701 (defun acdw/read-view-mode () 663 (acdw/reading-mode (if view-mode +1 -1)))))
702 (acdw/reading-mode (if view-mode +1 -1)))))
703 664
704(setup w32 665(setup w32
705 (:option w32-allow-system-shell t 666 (:option w32-allow-system-shell t
@@ -717,21 +678,21 @@ like a dumbass."
717 tab-width 4 678 tab-width 4
718 backward-delete-char-untabify-method 'hungry) 679 backward-delete-char-untabify-method 'hungry)
719 680
720 (:global "M-SPC" cycle-spacing)) 681 (:global "M-SPC" #'cycle-spacing))
721 682
722(setup windmove 683(setup windmove
723 (:option windmove-wrap-around t) 684 (:option windmove-wrap-around t)
724 (:global 685 (:global
725 ;; moving 686 ;; moving
726 "C-x 4 <left>" windmove-left 687 "C-x 4 <left>" #'windmove-left
727 "C-x 4 <right>" windmove-right 688 "C-x 4 <right>" #'windmove-right
728 "C-x 4 <up>" windmove-up 689 "C-x 4 <up>" #'windmove-up
729 "C-x 4 <down>" windmove-down 690 "C-x 4 <down>" #'windmove-down
730 ;; swapping 691 ;; swapping
731 "C-x 4 S-<left>" windmove-swap-states-left 692 "C-x 4 S-<left>" #'windmove-swap-states-left
732 "C-x 4 S-<right>" windmove-swap-states-right 693 "C-x 4 S-<right>" #'windmove-swap-states-right
733 "C-x 4 S-<up>" windmove-swap-states-up 694 "C-x 4 S-<up>" #'windmove-swap-states-up
734 "C-x 4 S-<down>" windmove-swap-states-down) 695 "C-x 4 S-<down>" #'windmove-swap-states-down)
735 696
736 (when (fboundp 'repeat-mode) 697 (when (fboundp 'repeat-mode)
737 (defvar windmove-repeat-map 698 (defvar windmove-repeat-map
@@ -761,34 +722,29 @@ like a dumbass."
761 722
762(setup window 723(setup window
763 (require 'acdw-bell) 724 (require 'acdw-bell)
764 (:option use-dialog-box nil 725 (:option Man-notify-method 'pushy
765 use-file-dialog nil 726 display-buffer-alist ; from FrostyX
766 tab-bar-show 1
767 visible-bell nil
768 ring-bell-function (lambda ()
769 (acdw-bell/flash-mode-line
770 (acdw/system :home)))
771 recenter-positions '(top middle bottom))
772
773 ;; from FrostyX:
774 ;; https://github.com/frostyx/dotfiles/blob/master/.emacs.d/frostyx.org#window-management
775 (:option display-buffer-alist
776 '(("shell.*" (display-buffer-same-window) ()) 727 '(("shell.*" (display-buffer-same-window) ())
777 (".*" (display-buffer-reuse-window 728 (".*" (display-buffer-reuse-window
778 display-buffer-same-window) 729 display-buffer-same-window)
779 (reusable-frames . t))) 730 (reusable-frames . t)))
780 ;; `display-buffer-alist' isn't respected by every command, so we 731 recenter-positions '(top middle bottom)
781 ;; /also/ need to set some of these. 732 ring-bell-function (lambda ()
782 Man-notify-method 'pushy) 733 (acdw-bell/flash-mode-line
783 734 (acdw/system :home)))
735 tab-bar-show 1
736 use-dialog-box nil
737 use-file-dialog nil
738 visible-bell nil)
739
784 (tooltip-mode -1)) 740 (tooltip-mode -1))
785 741
786(setup winner 742(setup winner
787 ;; see https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00888.html 743 ;; see https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00888.html
788 (:global "C-x 4 C-/" winner-undo 744 (:global "C-x 4 C-/" #'winner-undo
789 "C-x 4 /" winner-undo 745 "C-x 4 /" #'winner-undo
790 "C-x 4 C-?" winner-redo 746 "C-x 4 C-?" #'winner-redo
791 "C-x 4 ?" winner-redo) 747 "C-x 4 ?" #'winner-redo)
792 748
793 ;; add `winner-undo' and `winner-redo' to `repeat-mode' 749 ;; add `winner-undo' and `winner-redo' to `repeat-mode'
794 (when (fboundp 'repeat-mode) 750 (when (fboundp 'repeat-mode)
@@ -830,13 +786,13 @@ like a dumbass."
830 "A keymap for looking up things.") 786 "A keymap for looking up things.")
831 (global-set-key (kbd "C-c l") lookup-map) 787 (global-set-key (kbd "C-c l") lookup-map)
832 788
833 (:global "M-=" count-words 789 (:global "M-=" #'count-words
834 "C-w" kill-region-or-backward-word 790 "C-w" #'kill-region-or-backward-word
835 "C-c c c" capitalize-dwim 791 "C-c c c" #'capitalize-dwim
836 "C-c c t" titlecase-dwim 792 "C-c c t" #'titlecase-dwim
837 "C-c c u" upcase-dwim 793 "C-c c u" #'upcase-dwim
838 "C-c c l" downcase-dwim 794 "C-c c l" #'downcase-dwim
839 "C-c d" acdw/insert-iso-date 795 "C-c d" #'acdw/insert-iso-date
840 "M-`" nil) 796 "M-`" nil)
841 797
842 ;; toggle bindings 798 ;; toggle bindings
@@ -845,9 +801,9 @@ like a dumbass."
845 (global-set-key (kbd "C-c t") toggle-map) 801 (global-set-key (kbd "C-c t") toggle-map)
846 802
847 (:with-map toggle-map 803 (:with-map toggle-map
848 (:bind "c" column-number-mode 804 (:bind "c" #'column-number-mode
849 "l" display-line-numbers-mode 805 "l" #'display-line-numbers-mode
850 "d" toggle-debug-on-error)) 806 "d" #'toggle-debug-on-error))
851 807
852 (defalias 'forward-word-with-case 'forward-word 808 (defalias 'forward-word-with-case 'forward-word
853 "Alias for `forward-word' for use in `case-repeat-map'.") 809 "Alias for `forward-word' for use in `case-repeat-map'.")
@@ -921,44 +877,44 @@ like a dumbass."
921 (:global 877 (:global
922 ;; C-c bindings (`mode-specific-map') 878 ;; C-c bindings (`mode-specific-map')
923 ;; I don't use any of these right now. 879 ;; I don't use any of these right now.
924 ;; "C-c h" consult-history 880 ;; "C-c h" #'consult-history
925 ;; "C-c m" consult-mode-command 881 ;; "C-c m" #'consult-mode-command
926 ;; "C-c b" consult-bookmark 882 ;; "C-c b" #'consult-bookmark
927 ;; "C-c k" consult-kmacro 883 ;; "C-c k" #'consult-kmacro
928 ;; C-x bindings (`ctl-x-map') 884 ;; C-x bindings (`ctl-x-map')
929 "C-x M-:" consult-complex-command 885 "C-x M-:" #'consult-complex-command
930 "C-x b" consult-buffer 886 "C-x b" #'consult-buffer
931 "C-x 4 b" consult-buffer-other-window 887 "C-x 4 b" #'consult-buffer-other-window
932 "C-x 5 b" consult-buffer-other-frame 888 "C-x 5 b" #'consult-buffer-other-frame
933 ;; Custom M-# bindings for fast register access 889 ;; Custom M-# bindings for fast register access
934 "M-#" consult-register-load 890 "M-#" #'consult-register-load
935 "M-'" consult-register-store 891 "M-'" #'consult-register-store
936 "C-M-#" consult-register 892 "C-M-#" #'consult-register
937 ;; M-g bindings (`goto-map') 893 ;; M-g bindings (`goto-map')
938 "M-g e" consult-compile-error 894 "M-g e" #'consult-compile-error
939 "M-g g" consult-goto-line 895 "M-g g" #'consult-goto-line
940 "M-g M-g" consult-goto-line 896 "M-g M-g" #'consult-goto-line
941 "M-g o" consult-outline 897 "M-g o" #'consult-outline
942 "M-g m" consult-mark 898 "M-g m" #'consult-mark
943 "M-g k" consult-global-mark 899 "M-g k" #'consult-global-mark
944 "M-g i" consult-imenu 900 "M-g i" #'consult-imenu
945 "M-g I" consult-project-imenu 901 "M-g I" #'consult-project-imenu
946 ;; M-s bindings (`search-map') 902 ;; M-s bindings (`search-map')
947 "M-s g" acdw-consult/sensible-grep 903 "M-s g" #'acdw-consult/sensible-grep
948 "M-s f" acdw-consult/sensible-find 904 "M-s f" #'acdw-consult/sensible-find
949 "M-s l" consult-line 905 "M-s l" #'consult-line
950 "M-s m" consult-multi-occur 906 "M-s m" #'consult-multi-occur
951 "M-s k" consult-keep-lines 907 "M-s k" #'consult-keep-lines
952 "M-s u" consult-focus-lines 908 "M-s u" #'consult-focus-lines
953 ;; Other bindings 909 ;; Other bindings
954 "M-y" consult-yank-pop 910 "M-y" #'consult-yank-pop
955 "<help> a" consult-apropos 911 "<help> a" #'consult-apropos
956 ;; Isearch integration 912 ;; Isearch integration
957 "M-s e" consult-isearch) 913 "M-s e" #'consult-isearch)
958 (:with-map isearch-mode-map 914 (:with-map isearch-mode-map
959 (:bind "M-e" consult-isearch 915 (:bind "M-e" #'consult-isearch
960 "M-s e" consult-isearch 916 "M-s e" #'consult-isearch
961 "M-s l" consult-line)) 917 "M-s l" #'consult-line))
962 918
963 ;; see https://github.com/oantolin/completing-history 919 ;; see https://github.com/oantolin/completing-history
964 (defmacro consult-history-to-modes (map-hook-alist) 920 (defmacro consult-history-to-modes (map-hook-alist)
@@ -1043,10 +999,10 @@ like a dumbass."
1043 elpher-certificate-directory (acdw/dir "elpher/") 999 elpher-certificate-directory (acdw/dir "elpher/")
1044 elpher-gemini-max-fill-width fill-column) 1000 elpher-gemini-max-fill-width fill-column)
1045 1001
1046 (:bind "n" elpher-next-link 1002 (:bind "n" #'elpher-next-link
1047 "p" elpher-prev-link 1003 "p" #'elpher-prev-link
1048 "o" elpher-follow-current-link 1004 "o" #'elpher-follow-current-link
1049 "G" elpher-go-current) 1005 "G" #'elpher-go-current)
1050 1006
1051 (:hook acdw/reading-mode) 1007 (:hook acdw/reading-mode)
1052 1008
@@ -1064,7 +1020,7 @@ like a dumbass."
1064(setup (:straight (gemini-mode 1020(setup (:straight (gemini-mode
1065 :host nil 1021 :host nil
1066 :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) 1022 :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))
1067 (add-to-list 'auto-mode-alist '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode)) 1023 (:file-match (rx (seq "." (or "gemini" "gmi") eos)))
1068 (:hook turn-off-auto-fill)) 1024 (:hook turn-off-auto-fill))
1069 1025
1070(setup (:straight (gemini-write 1026(setup (:straight (gemini-write
@@ -1076,13 +1032,14 @@ like a dumbass."
1076 1032
1077(setup (:straight (mastodon 1033(setup (:straight (mastodon
1078 :host github 1034 :host github
1079 :repo "mooseyboots/mastodon.el")) 1035 :repo "mooseyboots/mastodon.el")
1080 (:straight request) 1036 request)
1081 (:option mastodon-instance-url "https://writing.exchange" 1037 (:option mastodon-instance-url "https://writing.exchange"
1082 mastodon-auth-source-file (car auth-sources) 1038 mastodon-auth-source-file (car auth-sources)
1083 mastodon-client--token-file (acdw/dir "mastodon.plstore")) 1039 mastodon-client--token-file (acdw/dir "mastodon.plstore"))
1084 (:hook hl-line-mode 1040
1085 acdw/reading-mode)) 1041 (:hook #'hl-line-mode
1042 #'acdw/reading-mode))
1086 1043
1087(setup (:straight (modus-themes 1044(setup (:straight (modus-themes
1088 :host gitlab 1045 :host gitlab
@@ -1107,11 +1064,12 @@ like a dumbass."
1107 orderless-component-separator #'orderless-escapable-split-on-space 1064 orderless-component-separator #'orderless-escapable-split-on-space
1108 orderless-style-dispatchers '(acdw/orderless-dispatch)) 1065 orderless-style-dispatchers '(acdw/orderless-dispatch))
1109 1066
1110 (defun fix-dollar (args) 1067 (:advise orderless-regexp :filter-args
1111 (if (string-suffix-p "$" (car args)) 1068 (defun fix-dollar (args)
1112 (list (concat (substring (car args) 0 -1) "[\x100000-\x10FFFD]*$")) 1069 (if (string-suffix-p "$" (car args))
1113 args)) 1070 (list (concat (substring (car args) 0 -1)
1114 (advice-add #'orderless-regexp :filter-args #'fix-dollar) 1071 "[\x100000-\x10FFFD]*$"))
1072 args)))
1115 1073
1116 (defun acdw/orderless-dispatch (pattern _index _total) 1074 (defun acdw/orderless-dispatch (pattern _index _total)
1117 "My custom dispatcher for `orderless'." 1075 "My custom dispatcher for `orderless'."
@@ -1174,15 +1132,14 @@ like a dumbass."
1174 vertico-count-format nil 1132 vertico-count-format nil
1175 vertico-cycle t) 1133 vertico-cycle t)
1176 1134
1177 (defun up-directory (arg) 1135 (:with-map vertico-map
1178 "Move up a directory (delete backwards to /)." 1136 (:bind "<C-backspace>"
1179 (interactive "p") 1137 (defun up-directory (arg)
1180 (if (string-match-p "/." (minibuffer-contents)) 1138 "Move up a directory (delete backwards to /)."
1181 (zap-up-to-char (- arg) ?/) 1139 (interactive "p")
1182 (backward-kill-word arg))) 1140 (if (string-match-p "/." (minibuffer-contents))
1183 1141 (zap-up-to-char (- arg) ?/)
1184 (with-eval-after-load 'vertico 1142 (backward-kill-word arg)))))
1185 (define-key vertico-map (kbd "<C-backspace>") #'up-directory))
1186 1143
1187 (if (boundp 'comp-deferred-compilation-deny-list) 1144 (if (boundp 'comp-deferred-compilation-deny-list)
1188 (add-to-list 'comp-deferred-compilation-deny-list "vertico")) 1145 (add-to-list 'comp-deferred-compilation-deny-list "vertico"))
@@ -1194,14 +1151,14 @@ like a dumbass."
1194 (vertico-mouse-mode +1) 1151 (vertico-mouse-mode +1)
1195 1152
1196 ;; Prefix the current candidate with "> ". From Vertico wiki. 1153 ;; Prefix the current candidate with "> ". From Vertico wiki.
1197 (defun vertico-format@add-arrow (orig cand prefix suffix index _start) 1154
1198 (setq cand (funcall orig cand prefix suffix index _start)) 1155 (:advise vertico--format-candidate :around
1199 (concat 1156 (defun vertico-format@add-arrow (orig cand pref suf index start)
1200 (if (= vertico--index index) 1157 (setq cand (funcall orig cand pref suf index start))
1201 (propertize "> " 'face 'vertico-current) 1158 (concat (if (= vertico--index index)
1202 " ") 1159 (propertize "> " 'face 'vertico-current)
1203 cand)) 1160 " ")
1204 (advice-add #'vertico--format-candidate :around #'vertico-format@add-arrow)) 1161 cand))))
1205 1162
1206(setup (:straight alert) 1163(setup (:straight alert)
1207 (:option alert-default-style (acdw/system 1164 (:option alert-default-style (acdw/system
@@ -1210,18 +1167,20 @@ like a dumbass."
1210 1167
1211(setup (:straight async) 1168(setup (:straight async)
1212 (autoload 'dired-async-mode "dired-async.el" nil t) 1169 (autoload 'dired-async-mode "dired-async.el" nil t)
1170
1213 (dired-async-mode +1) 1171 (dired-async-mode +1)
1172
1214 (add-hook 'dired-mode 1173 (add-hook 'dired-mode
1215 (defun dired@disable-dired-async-mode-line () 1174 (defun dired@disable-dired-async-mode-line ()
1216 (autoload 'dired-async--modeline-mode "dired-async.el" nil t) 1175 (autoload 'dired-async--modeline-mode "dired-async.el" nil t)
1217 (dired-async--modeline-mode -1)))) 1176 (dired-async--modeline-mode -1))))
1218 1177
1219(setup (:straight avy) 1178(setup (:straight avy)
1220 (:global "C-:" avy-goto-char-timer 1179 (:global "C-:" #'avy-goto-char-timer
1221 "C-c C-j" avy-resume) 1180 "C-c C-j" #'avy-resume)
1222 1181
1223 (with-eval-after-load "isearch" 1182 (:with-feature isearch
1224 (define-key isearch-mode-map (kbd "C-'") #'avy-isearch))) 1183 (:bind "C-'" #'avy-isearch)))
1225 1184
1226(setup (:straight circe) 1185(setup (:straight circe)
1227 (require 'circe) 1186 (require 'circe)
@@ -1234,27 +1193,44 @@ like a dumbass."
1234 circe-default-nick "acdw" 1193 circe-default-nick "acdw"
1235 circe-default-part-message "See You, Space Cowpokes . . ." 1194 circe-default-part-message "See You, Space Cowpokes . . ."
1236 circe-default-user "acdw" 1195 circe-default-user "acdw"
1196 circe-format-action
1197 (lambda (&rest plist)
1198 (concat
1199 (acdw-irc/margin-format "" "*" "*" t)
1200 " " (plist-get plist :nick) " " (plist-get plist :body)))
1201 circe-format-say
1202 (lambda (&rest plist)
1203 (concat
1204 (acdw-irc/margin-format (plist-get plist :nick) "" " |" t)
1205 " " (plist-get plist :body)))
1206 circe-format-self-action
1207 (lambda (&rest plist)
1208 (concat
1209 (acdw-irc/margin-format "" "-*" " *" t)
1210 " " (plist-get plist :nick) " " (plist-get plist :body)))
1211 circe-format-self-say
1212 (lambda (&rest plist)
1213 (concat
1214 (acdw-irc/margin-format (plist-get plist :nick) "-" " >" t)
1215 " " (plist-get plist :body)))
1237 circe-highlight-nick-type 'sender 1216 circe-highlight-nick-type 'sender
1238 circe-network-options 1217 circe-network-options
1239 `(("Libera Chat" 1218 `(("Libera Chat"
1240 :channels ("#emacs" "#systemcrafters" "##webpals") 1219 :channels ("#emacs" "#systemcrafters" "##webpals")
1241 :sasl-username "acdw" 1220 :sasl-username circe-default-nick
1242 :sasl-password ,(acdw/make-password-fetcher 1221 :sasl-password ,(acdw/make-password-fetcher
1243 :host "libera.chat")) 1222 :host "libera.chat"))
1244 ("Tilde Chat" 1223 ("Tilde Chat" :host "irc.tilde.chat" :port 6697 :use-tls t
1245 :channels ("#meta" "#bread" "#dadjokes" "#team") 1224 :channels ("#meta" "#bread" "#dadjokes" "#team")
1246 :host "irc.tilde.chat" :port 6697 :use-tls t 1225 :sasl-username circe-default-nick
1247 :sasl-username "acdw"
1248 :sasl-password ,(acdw/make-password-fetcher 1226 :sasl-password ,(acdw/make-password-fetcher
1249 :host "tilde.chat")) 1227 :host "tilde.chat"))
1250 ("Casa" 1228 ("Casa" :host "m455.casa" :port 6697 :use-tls t
1251 :channels ("#basement") 1229 :channels ("#basement")
1252 :host "m455.casa" :port 6697 :use-tls t 1230 :sasl-username circe-default-nick
1253 :sasl-username "acdw"
1254 :sasl-password ,(acdw/make-password-fetcher 1231 :sasl-password ,(acdw/make-password-fetcher
1255 :host "m455.casa")) 1232 :host "m455.casa"))
1256 ("Piss" 1233 ("Piss" :host "piss.hmm.st" :port 6697 :use-tls t))
1257 :host "piss.hmm.st" :port 6697 :use-tls t))
1258 circe-reduce-lurker-spam t 1234 circe-reduce-lurker-spam t
1259 circe-server-auto-join-default-type :after-auth) 1235 circe-server-auto-join-default-type :after-auth)
1260 1236
@@ -1262,13 +1238,15 @@ like a dumbass."
1262 ((t (:inherit (modus-themes-hl-line)))) 1238 ((t (:inherit (modus-themes-hl-line))))
1263 :now)) 1239 :now))
1264 1240
1265 (:bind "C-c C-p" circe-command-PART) 1241 (:bind "C-c C-p" #'circe-command-PART)
1266 1242
1267 (:advise circe-command-PART :after 1243 (:advise circe-command-PART :after
1268 (defun circe-command-PART@kill-buffer (&rest _) 1244 (defun circe-command-PART@kill-buffer (&rest _)
1269 (kill-buffer))) 1245 (let ((circe-channel-killed-confirmation nil))
1246 (kill-buffer))))
1270 1247
1271 (add-hook 'circe-chat-mode-hook 1248 (:with-mode circe-chat-mode
1249 (:hook #'acdw/stop-paren-annoyances
1272 (defun circe-chat@setup () 1250 (defun circe-chat@setup ()
1273 (lui-set-prompt 1251 (lui-set-prompt
1274 (concat (propertize (acdw-irc/margin-format (buffer-name) 1252 (concat (propertize (acdw-irc/margin-format (buffer-name)
@@ -1280,70 +1258,37 @@ like a dumbass."
1280 " ")) 1258 " "))
1281 (enable-circe-color-nicks) 1259 (enable-circe-color-nicks)
1282 (enable-circe-display-images) 1260 (enable-circe-display-images)
1283 (enable-circe-new-day-notifier))) 1261 (enable-circe-new-day-notifier))))
1284
1285 (add-hook 'circe-chat-mode-hook #'acdw/stop-paren-annoyances)
1286 1262
1287 (autoload 'circe-nick-color-reset "circe-color-nicks") 1263 (autoload 'circe-nick-color-reset "circe-color-nicks")
1288 (add-hook 'modus-themes-after-load-theme-hook 1264 (add-hook 'modus-themes-after-load-theme-hook
1289 #'circe-nick-color-reset) 1265 #'circe-nick-color-reset)
1290 1266
1291 (setq circe-format-say 1267 (:with-mode lui-mode
1292 (lambda (&rest plist) 1268 (:option lui-fill-column fill-column
1293 (concat 1269 lui-fill-type (repeat-string acdw-irc/left-margin " ")
1294 (acdw-irc/margin-format (plist-get plist :nick) "" " |" t) 1270 lui-time-stamp-position 'right-margin
1295 " " 1271 lui-time-stamp-format "%H:%M"
1296 (plist-get plist :body))) 1272 lui-track-behavior 'before-switch-to-buffer
1297 1273 lui-track-indicator 'fringe)
1298 circe-format-self-say 1274
1299 (lambda (&rest plist) 1275 (:hook (defun lui-mode@setup ()
1300 (concat 1276 (setq-local fringes-outside-margins t
1301 (acdw-irc/margin-format (plist-get plist :nick) "-" " >" t) 1277 right-margin-width 5
1302 " " 1278 scroll-margin 0
1303 (plist-get plist :body))) 1279 word-wrap t
1304 1280 wrap-prefix (repeat-string
1305 circe-format-action 1281 acdw-irc/left-margin " ")
1306 (lambda (&rest plist) 1282 line-number-mode nil)
1307 (concat 1283 (enable-lui-track)))))
1308 (acdw-irc/margin-format "" "*" "*" t)
1309 " "
1310 (plist-get plist :nick) " "
1311 (plist-get plist :body)))
1312
1313 circe-format-self-action
1314 (lambda (&rest plist)
1315 (concat
1316 (acdw-irc/margin-format "" "-*" " *" t)
1317 " "
1318 (plist-get plist :nick) " "
1319 (plist-get plist :body)))
1320
1321 lui-fill-type (repeat-string acdw-irc/left-margin " "))
1322
1323 (:option lui-fill-column fill-column
1324 lui-time-stamp-position 'right-margin
1325 lui-time-stamp-format "%H:%M"
1326 lui-track-behavior 'before-switch-to-buffer
1327 lui-track-indicator 'fringe)
1328
1329 (add-hook 'lui-mode-hook
1330 (defun lui-mode@setup ()
1331 (setq-local fringes-outside-margins t
1332 right-margin-width 5
1333 scroll-margin 0
1334 word-wrap t
1335 wrap-prefix (repeat-string
1336 acdw-irc/left-margin " ")
1337 line-number-mode nil)
1338 (enable-lui-track))))
1339 1284
1340(setup (:straight crux) 1285(setup (:straight crux)
1341 1286
1342 (:global "C-x o" acdw/other-window-or-switch-buffer 1287 (:global "C-x o" #'acdw/other-window-or-switch-buffer
1343 "C-o" crux-smart-open-line 1288 "C-o" #'crux-smart-open-line
1344 "M-o" crux-smart-open-line-above 1289 "M-o" #'crux-smart-open-line-above
1345 "C-M-\\" crux-cleanup-buffer-or-region 1290 "C-M-\\" #'crux-cleanup-buffer-or-region
1346 "C-x 4 t" crux-transpose-windows) 1291 "C-x 4 t" #'crux-transpose-windows)
1347 1292
1348 (when (fboundp 'repeat-mode) 1293 (when (fboundp 'repeat-mode)
1349 (unless (boundp 'other-window-repeat-map) 1294 (unless (boundp 'other-window-repeat-map)
@@ -1370,9 +1315,9 @@ like a dumbass."
1370 (require 'edit-server nil :noerror)) 1315 (require 'edit-server nil :noerror))
1371 (edit-server-start) 1316 (edit-server-start)
1372 1317
1373 (advice-add 'edit-server-make-frame :before 1318 (:advise edit-server-make-frame :before
1374 (defun edit-server@set-a-variable (&rest _) 1319 (defun edit-server@set-a-variable (&rest _)
1375 (setq-local edit-server-frame-p t))))) 1320 (setq-local edit-server-frame-p t)))))
1376 1321
1377(setup (:straight elfeed 1322(setup (:straight elfeed
1378 elfeed-protocol) 1323 elfeed-protocol)
@@ -1383,39 +1328,33 @@ like a dumbass."
1383 :host "mf.acdw.net")))) 1328 :host "mf.acdw.net"))))
1384 1329
1385 (elfeed-protocol-enable) 1330 (elfeed-protocol-enable)
1386 1331
1387 (add-hook 'elfeed-show-mode-hook 1332 (:with-mode elfeed-show-mode
1388 (defun elfeed-show@setup () 1333 (:hook (defun elfeed-show@setup ()
1389 (acdw/reading-mode))) 1334 (acdw/reading-mode)))
1390 1335
1391 ;; see https://irreal.org/blog/?p=8885 1336 ;; see https://irreal.org/blog/?p=8885
1392 ;; Lazy Elfeed (karthinks) 1337 (:bind "SPC" (defun elfeed-scroll-up-command (&optional arg)
1393 (defun elfeed-scroll-up-command (&optional arg) 1338 "Scroll up or go to next feed item in Elfeed"
1394 "Scroll up or go to next feed item in Elfeed" 1339 (interactive "^P")
1395 (interactive "^P") 1340 (let ((scroll-error-top-bottom nil))
1396 (let ((scroll-error-top-bottom nil)) 1341 (condition-case-unless-debug nil
1397 (condition-case-unless-debug nil 1342 (scroll-up-command arg)
1398 (scroll-up-command arg) 1343 (error (elfeed-show-next)))))
1399 (error (elfeed-show-next))))) 1344 "S-SPC" (defun elfeed-scroll-down-command (&optional arg)
1400 1345 "Scroll up or go to next feed item in Elfeed"
1401 (defun elfeed-scroll-down-command (&optional arg) 1346 (interactive "^P")
1402 "Scroll up or go to next feed item in Elfeed" 1347 (let ((scroll-error-top-bottom nil))
1403 (interactive "^P") 1348 (condition-case-unless-debug nil
1404 (let ((scroll-error-top-bottom nil)) 1349 (scroll-down-command arg)
1405 (condition-case-unless-debug nil 1350 (error (elfeed-show-prev))))))))
1406 (scroll-down-command arg)
1407 (error (elfeed-show-prev)))))
1408
1409 ;; Turns out, `scroll-up' and `scroll-down' are /backward/
1410 (define-key elfeed-show-mode-map (kbd "SPC") 'elfeed-scroll-up-command)
1411 (define-key elfeed-show-mode-map (kbd "S-SPC") 'elfeed-scroll-down-command))
1412 1351
1413(setup (:straight elisp-slime-nav) 1352(setup (:straight elisp-slime-nav)
1414 (:hook-into emacs-lisp-mode 1353 (:hook-into emacs-lisp-mode
1415 ielm-mode)) 1354 ielm-mode))
1416 1355
1417(setup (:straight embark) 1356(setup (:straight embark)
1418 (:global "C-." embark-act) 1357 (:global "C-." #'embark-act)
1419 (:option prefix-help-command #'embark-prefix-help-command 1358 (:option prefix-help-command #'embark-prefix-help-command
1420 (append display-buffer-alist) 1359 (append display-buffer-alist)
1421 '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" 1360 '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
@@ -1437,18 +1376,20 @@ like a dumbass."
1437 #'consult-preview-at-point-mode))) 1376 #'consult-preview-at-point-mode)))
1438 1377
1439(setup (:straight epithet) 1378(setup (:straight epithet)
1440 (add-hook 'Info-selection-hook #'epithet-rename-buffer) 1379 (dolist (hook '(Info-selection-hook
1441 (add-hook 'eww-after-render-hook #'epithet-rename-buffer) 1380 eww-after-render-hook
1442 (add-hook 'help-mode-hook #'epithet-rename-buffer) 1381 help-mode-hook
1443 (add-hook 'occur-mode-hook #'epithet-rename-buffer)) 1382 occur-mode-hook))
1383 (add-hook hook #'epithet-rename-buffer)))
1444 1384
1445(setup (:straight eros) 1385(setup (:straight eros)
1446 (:hook-into emacs-lisp-mode)) 1386 (:hook-into emacs-lisp-mode))
1447 1387
1448(setup (:straight expand-region) 1388(setup (:straight expand-region)
1449 1389 (:global "C-=" #'er/expand-region
1450 (defun acdw/set-mark-or-expand-region (arg) 1390 "C-SPC"
1451 "Set mark at point and activate, jump to mark, or expand region. 1391 (defun acdw/set-mark-or-expand-region (arg)
1392 "Set mark at point and activate, jump to mark, or expand region.
1452See `set-mark-command' and `expand-region'. 1393See `set-mark-command' and `expand-region'.
1453 1394
1454With no prefix argument, either run `set-mark-command' on first 1395With no prefix argument, either run `set-mark-command' on first
@@ -1458,29 +1399,22 @@ With any prefix argument
1458(e.g., \\[universal-argument] \\[set-mark-command]), act as with 1399(e.g., \\[universal-argument] \\[set-mark-command]), act as with
1459`set-mark-command' (i.e., pop the mark). Don't care about 1400`set-mark-command' (i.e., pop the mark). Don't care about
1460successive invocations." 1401successive invocations."
1461 (interactive "P") 1402 (interactive "P")
1462 (cond 1403 (cond
1463 ((or arg 1404 ((or arg
1464 (and set-mark-command-repeat-pop 1405 (and set-mark-command-repeat-pop
1465 (eq last-command 'pop-to-mark-command))) 1406 (eq last-command 'pop-to-mark-command)))
1466 (setq this-command 'set-mark-command) 1407 (setq this-command 'set-mark-command)
1467 (set-mark-command arg)) 1408 (set-mark-command arg))
1468 ((eq last-command 'acdw/set-mark-or-expand-region) 1409 ((eq last-command 'acdw/set-mark-or-expand-region)
1469 (er/expand-region 1)) 1410 (er/expand-region 1))
1470 (t (set-mark-command arg)))) 1411 (t (set-mark-command arg))))))
1471
1472 (:global "C-=" er/expand-region
1473 "C-SPC" acdw/set-mark-or-expand-region))
1474 1412
1475(setup (:straight flyspell-correct) 1413(setup (:straight flyspell-correct)
1476 (add-hook 'flyspell-mode-hook 1414 (:with-mode flyspell-mode
1477 (defun flyspell-mode@flyspell-correct () 1415 (:hook (defun flyspell@correct ()
1478 (dolist (keybind '(("C-;" . flyspell-correct-wrapper) 1416 (:bind "C-;" #'flyspell-correct-wrapper)
1479 ("C-," . nil) 1417 (:unbind "C-," "C-." "C-M-i")))))
1480 ("C-." . nil)
1481 ("C-M-i" . nil)))
1482 (define-key flyspell-mode-map
1483 (kbd (car keybind)) (cdr keybind))))))
1484 1418
1485(setup (:straight gcmh) 1419(setup (:straight gcmh)
1486 (:option gcmh-idle-delay 'auto) 1420 (:option gcmh-idle-delay 'auto)
@@ -1489,40 +1423,40 @@ successive invocations."
1489;; TODO: figure out a popper.el / shackle.el ... thing to fix this 1423;; TODO: figure out a popper.el / shackle.el ... thing to fix this
1490(setup (:straight helpful) 1424(setup (:straight helpful)
1491 (:option helpful-max-buffers 5) 1425 (:option helpful-max-buffers 5)
1492 (:global "<help> f" helpful-callable 1426 (:global "<help> f" #'helpful-callable
1493 "<help> v" helpful-variable 1427 "<help> v" #'helpful-variable
1494 "<help> k" helpful-key 1428 "<help> k" #'helpful-key
1495 "<help> o" helpful-symbol 1429 "<help> o" #'helpful-symbol))
1496 "C-c C-d" helpful-at-point))
1497 1430
1498(setup (:straight hungry-delete) 1431(setup (:straight hungry-delete)
1499
1500 (with-eval-after-load 'paredit
1501 (define-key paredit-mode-map [remap paredit-backward-delete]
1502 (defun acdw/paredit-hungry-delete-backward (arg)
1503 (interactive "P")
1504 (if (looking-back "[ \t]" 1)
1505 (hungry-delete-backward (or arg 1))
1506 (paredit-backward-delete arg))))
1507
1508 (define-key paredit-mode-map [remap paredit-forward-delete]
1509 (defun acdw/paredit-hungry-delete-forward (arg)
1510 (interactive "P")
1511 (if (looking-at "[ \t]")
1512 (hungry-delete-forward (or arg 1))
1513 (paredit-forward-delete arg)))))
1514
1515 (:option hungry-delete-chars-to-skip " \t" 1432 (:option hungry-delete-chars-to-skip " \t"
1516 hungry-delete-join-reluctantly nil) 1433 hungry-delete-join-reluctantly nil)
1517 (global-hungry-delete-mode +1)) 1434
1435 (global-hungry-delete-mode +1)
1436
1437 (:with-feature paredit
1438 (:bind [remap paredit-backward-delete]
1439 (defun acdw/paredit-hungry-delete-backward (arg)
1440 (interactive "P")
1441 (if (looking-back "[ \t]" 1)
1442 (hungry-delete-backward (or arg 1))
1443 (paredit-backward-delete arg)))
1444
1445 [remap paredit-forward-delete]
1446 (defun acdw/paredit-hungry-delete-forward (arg)
1447 (interactive "P")
1448 (if (looking-at "[ \t]")
1449 (hungry-delete-forward (or arg 1))
1450 (paredit-forward-delete arg))))))
1518 1451
1519(setup (:straight iscroll) 1452(setup (:straight iscroll)
1520 (define-globalized-minor-mode global-iscroll-mode 1453 (define-globalized-minor-mode global-iscroll-mode iscroll-mode
1521 iscroll-mode 1454 (lambda () (iscroll-mode +1)))
1522 (lambda () (iscroll-mode +1)))) 1455
1456 (global-iscroll-mode +1))
1523 1457
1524(setup (:straight lacarte) 1458(setup (:straight lacarte)
1525 (:global "<f10>" lacarte-execute-menu-command)) 1459 (:global "<f10>" #'lacarte-execute-menu-command))
1526 1460
1527(setup (:straight link-hint) 1461(setup (:straight link-hint)
1528 ;; Browse web URLs with a browser with a prefix argument. 1462 ;; Browse web URLs with a browser with a prefix argument.
@@ -1541,31 +1475,30 @@ successive invocations."
1541 (link-hint-define-type type 1475 (link-hint-define-type type
1542 :open-secondary browse-url-secondary-browser-function)) 1476 :open-secondary browse-url-secondary-browser-function))
1543 1477
1544 (defun acdw/link-hint-open-link (arg) 1478 (:option link-hint-avy-style 'at)
1545 "Open a link using `link-hint-open-link', but like `browse-url-at-point'. 1479 (:global "C-;"
1480 (defun acdw/link-hint-open-link (arg)
1481 "Open a link using `link-hint-open-link', prefix-aware.
1546That is, a prefix argument (\\[universal-argument]) will open the 1482That is, a prefix argument (\\[universal-argument]) will open the
1547browser defined in `browse-url-secondary-browser-function'." 1483browser defined in `browse-url-secondary-browser-function'."
1548 (interactive "P") 1484 (interactive "P")
1549 (avy-with link-hint-open-link 1485 (avy-with link-hint-open-link
1550 (link-hint--one (if arg :open-secondary :open)))) 1486 (link-hint--one (if arg :open-secondary :open))))))
1551
1552 (setq link-hint-avy-style 'at)
1553 (:global "C-;" acdw/link-hint-open-link))
1554 1487
1555(setup (:straight lua-mode) 1488(setup (:straight lua-mode)
1556 (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))) 1489 (:file-match (rx ".lua" eos)))
1557 1490
1558(setup (:straight macrostep) 1491(setup (:straight macrostep)
1559 (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)) 1492 (:with-mode emacs-lisp-mode
1493 (:bind "C-c e" #'macrostep-expand)))
1560 1494
1561(setup (:straight magit) 1495(setup (:straight magit)
1562 (:global "C-c g" magit-status) 1496 (:global "C-c g" #'magit-status)
1563 1497
1564 (defun magit-display-buffer-same-window (buffer) 1498 (:option magit-display-buffer-function
1565 "Display BUFFER in the selected window like God intended." 1499 (defun magit-display-buffer-same-window (buffer)
1566 (display-buffer buffer '(display-buffer-same-window))) 1500 "Display BUFFER in the selected window like God intended."
1567 1501 (display-buffer buffer '(display-buffer-same-window)))
1568 (:option magit-display-buffer-function #'magit-display-buffer-same-window
1569 magit-popup-display-buffer-action '((display-buffer-same-window)) 1502 magit-popup-display-buffer-action '((display-buffer-same-window))
1570 magit-refresh-status-buffer nil)) 1503 magit-refresh-status-buffer nil))
1571 1504
@@ -1587,33 +1520,32 @@ browser defined in `browse-url-secondary-browser-function'."
1587 (append apheleia-mode-alist) '(gfm-mode . markdownfmt))))) 1520 (append apheleia-mode-alist) '(gfm-mode . markdownfmt)))))
1588 1521
1589(setup (:straight mwim) 1522(setup (:straight mwim)
1590 (:global "C-a" mwim-beginning 1523 (:global "C-a" #'mwim-beginning
1591 "C-e" mwim-end)) 1524 "C-e" #'mwim-end))
1592 1525
1593(setup (:straight nov) 1526(setup (:straight nov)
1594 (:option nov-text-width fill-column) 1527 (:option nov-text-width fill-column)
1595 (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) 1528 (:file-match (rx ".epub" eos)))
1596 1529
1597(setup (:straight olivetti) 1530(setup (:straight olivetti)
1598 (:option olivetti-body-width (+ fill-column 4) 1531 (:option olivetti-body-width (+ fill-column 4)
1599 olivetti-minimum-body-width fill-column) 1532 olivetti-minimum-body-width fill-column)
1600 1533
1601 (add-hook 'olivetti-mode-hook 1534 (:hook (defun olivetti-mode@setup ()
1602 (defun acdw/olivetti-mode-hook () 1535 (if olivetti-mode
1603 (if olivetti-mode 1536 (setq-local indicate-empty-lines nil
1604 (setq-local indicate-empty-lines nil 1537 indicate-buffer-boundaries nil)
1605 indicate-buffer-boundaries nil) 1538 (acdw/setup-fringes)))))
1606 (acdw/setup-fringes)))))
1607 1539
1608(setup (:straight org 1540(setup (:straight org
1609 org-contrib) 1541 org-contrib)
1610 (require 'acdw-org) ; so I don't clutter up init.el 1542 (:also-load 'acdw-org) ; so I don't clutter up init.el
1611 (:option 1543 (:option
1612 org-adapt-indentation nil 1544 org-adapt-indentation nil
1613 org-agenda-files nil ; only until I set this up 1545 org-agenda-files nil ; only until I set this up
1614 org-catch-invisible-edits 'smart 1546 org-catch-invisible-edits 'smart
1615 org-clock-clocked-in-display 'mode-line 1547 org-clock-clocked-in-display 'mode-line
1616 org-clock-string-limit 7 ; gives time and not title 1548 org-clock-string-limit 7 ; gives time and not title
1617 org-confirm-babel-evaluate nil 1549 org-confirm-babel-evaluate nil
1618 org-directory "~/org" 1550 org-directory "~/org"
1619 org-ellipsis " …" 1551 org-ellipsis " …"
@@ -1643,39 +1575,35 @@ browser defined in `browse-url-secondary-browser-function'."
1643 org-tags-column 0 ; (- 0 fill-column -3) 1575 org-tags-column 0 ; (- 0 fill-column -3)
1644 ) 1576 )
1645 1577
1646 (:bind "RET" acdw-org/return-dwim 1578 (:bind "RET" #'acdw-org/return-dwim
1647 "<S-return>" acdw-org/org-table-copy-down 1579 "<S-return>" #'acdw-org/org-table-copy-down
1648 "M-SPC M-SPC" insert-zero-width-space 1580 "M-SPC M-SPC" #'insert-zero-width-space
1649 "C-c C-l" org-insert-link-dwim 1581 "C-c C-l" #'org-insert-link-dwim
1650 "M-w" acdw/copy-region-plain 1582 "M-w" #'acdw/copy-region-plain
1651 "C-c C-n" acdw/org-next-heading-widen 1583 "C-c C-n" #'acdw/org-next-heading-widen
1652 "C-c C-p" acdw/org-previous-heading-widen) 1584 "C-c C-p" #'acdw/org-previous-heading-widen)
1653 1585
1654 (with-eval-after-load 'org-export 1586 (with-eval-after-load 'org-export
1655 (add-to-list 'org-export-filter-final-output-functions 1587 (add-to-list 'org-export-filter-final-output-functions
1656 #'org-export-remove-zero-width-spaces)) 1588 #'org-export-remove-zero-width-spaces))
1657 1589
1658 (defun acdw/org-fix-lines-before-save ()
1659 (add-hook 'before-save-hook #'acdw-org/fix-blank-lines-in-buffer 0 :local))
1660
1661 (:hook variable-pitch-mode 1590 (:hook variable-pitch-mode
1662 olivetti-mode 1591 olivetti-mode
1663 acdw/org-fix-lines-before-save) 1592 (defun acdw/org-fix-lines-before-save ()
1593 (add-hook 'before-save-hook
1594 #'acdw-org/fix-blank-lines-in-buffer 0 :local))
1595 (defun org-mode@wc-stupid ()
1596 (unless (and wc-mode
1597 (> 0 (+ (or wc-orig-words 0)
1598 (or wc-words-delta 0)))))
1599 (setq-local
1600 wc-count-words-function
1601 (lambda (start end) "Count words stupidly with a limit."
1602 (acdw-org/count-words-stupidly start
1603 end
1604 999)))))
1664 1605
1665 (advice-add 'org-delete-backward-char 1606 (:advise org-delete-backward-char :override #'acdw-org/delete-backward-char))
1666 :override #'acdw-org/delete-backward-char)
1667
1668 (add-hook 'org-mode-hook
1669 (defun org-mode@wc-stupid ()
1670 (unless (and wc-mode
1671 (> 0 (+ (or wc-orig-words 0)
1672 (or wc-words-delta 0)))))
1673 (setq-local
1674 wc-count-words-function
1675 (lambda (start end) "Count words stupidly with a limit."
1676 (acdw-org/count-words-stupidly start
1677 end
1678 999))))))
1679 1607
1680(setup (:straight org-appear) 1608(setup (:straight org-appear)
1681 (:hook-into org-mode)) 1609 (:hook-into org-mode))
@@ -1686,24 +1614,24 @@ browser defined in `browse-url-secondary-browser-function'."
1686 1614
1687(setup (:straight page-break-lines) 1615(setup (:straight page-break-lines)
1688 (global-page-break-lines-mode +1)) 1616 (global-page-break-lines-mode +1))
1689(setup (:straight paredit)
1690 1617
1618(setup (:straight paredit)
1691 ;; I don't use paredit-splice-sexp much, and it stomps on isearch. 1619 ;; I don't use paredit-splice-sexp much, and it stomps on isearch.
1692 (:unbind "M-s") 1620 (:unbind "M-s")
1693 1621
1694 (defun paredit@setup () 1622 (defun paredit@setup ()
1695 "Correct weirdnesses and set up paredit mode." 1623 "Correct weirdnesses and set up paredit mode."
1696 (:with-map lisp-mode-shared-map 1624 (:with-map lisp-mode-shared-map
1697 (:bind "DEL" paredit-backward-delete 1625 (:bind "DEL" #'paredit-backward-delete
1698 "C-M-;" comment-or-uncomment-sexp 1626 "C-M-;" #'comment-or-uncomment-sexp
1699 "C-<backspace>" paredit-backward-kill-word)) 1627 "C-<backspace>" #'paredit-backward-kill-word))
1700 (paredit-mode +1)) 1628 (paredit-mode +1))
1701 1629
1702 (dolist (mode lispy-modes) 1630 (dolist (mode lispy-modes)
1703 (add-hook (intern (concat (symbol-name mode) "-hook")) 1631 (add-hook (intern (concat (symbol-name mode) "-hook"))
1704 #'paredit@setup)) 1632 #'paredit@setup))
1705 1633
1706 (require 'eldoc) 1634 (:also-load 'eldoc)
1707 (eldoc-add-command 'paredit-backward-delete 'paredit-close-round)) 1635 (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))
1708 1636
1709(setup (:straight paren-face) 1637(setup (:straight paren-face)
@@ -1723,53 +1651,54 @@ browser defined in `browse-url-secondary-browser-function'."
1723 (buffer-list))) 1651 (buffer-list)))
1724 1652
1725(setup (:straight powerthesaurus) 1653(setup (:straight powerthesaurus)
1726 (:global (kbd "C-c l t") #'powerthesaurus-lookup-word-dwim)) 1654 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim))
1727 1655
1728(setup (:straight restart-emacs) 1656(setup (:straight restart-emacs)
1729 (defun emacs-upgrade (&optional update-packages) 1657 (defun emacs-upgrade (&optional update-packages)
1730 "Pull config, upgrade packages, restart Emacs." 1658 "Pull config, upgrade packages, restart Emacs."
1731 (interactive "P") 1659 (interactive "P")
1660 (emacs-git-pull-config)
1732 (when update-packages 1661 (when update-packages
1662 (require 'straight)
1733 (straight-pull-all)) 1663 (straight-pull-all))
1734 (emacs-git-pull-config)
1735 (restart-emacs))) 1664 (restart-emacs)))
1736 1665
1737(setup (:straight simple-modeline) 1666(setup (:straight simple-modeline
1738 (setup (:straight minions)) 1667 minions)
1739 (require 'acdw-modeline) 1668 (:also-load acdw-modeline)
1740 (:option 1669 (:option simple-modeline-segments
1741 simple-modeline-segments '(;; left 1670 '(;; left
1742 (acdw-modeline/modified 1671 (acdw-modeline/modified
1743 acdw-modeline/buffer-name 1672 acdw-modeline/buffer-name
1744 acdw-modeline/vc-branch 1673 acdw-modeline/vc-branch
1745 acdw-modeline/winum 1674 acdw-modeline/winum
1746 acdw-modeline/position) 1675 acdw-modeline/position)
1747 ;; right 1676 ;; right
1748 (acdw-modeline/track 1677 (acdw-modeline/track
1749 simple-modeline-segment-misc-info 1678 simple-modeline-segment-misc-info
1750 acdw-modeline/wc 1679 acdw-modeline/wc
1751 acdw-modeline/text-scale 1680 acdw-modeline/text-scale
1752 simple-modeline-segment-process 1681 simple-modeline-segment-process
1753 acdw-modeline/god-mode-indicator 1682 acdw-modeline/god-mode-indicator
1754 acdw-modeline/minions 1683 acdw-modeline/minions
1755 acdw-modeline/narrowed 1684 acdw-modeline/narrowed
1756 acdw-modeline/major-mode))) 1685 acdw-modeline/major-mode)))
1757 1686
1758 ;; I've put in a pull request to add the (- 0 right-margin) bit here. 1687 ;; I've put in a pull request to add the (- 0 right-margin) bit here.
1759 (advice-add 'simple-modeline--format :override 1688 (:advise simple-modeline--format :override
1760 (defun simple-modeline@format (lefts rights) 1689 (defun simple-modeline@format (lefts rights)
1761 (let* ((left (simple-modeline--format-segments lefts)) 1690 (let* ((left (simple-modeline--format-segments lefts))
1762 (right (simple-modeline--format-segments rights)) 1691 (right (simple-modeline--format-segments rights))
1763 (reserve (length right))) 1692 (reserve (length right)))
1764 (concat 1693 (concat
1765 left 1694 left
1766 (propertize " " 1695 (propertize " "
1767 'display `((space :align-to 1696 'display `((space :align-to
1768 (- right 1697 (- right
1769 (- 0 right-margin) 1698 (- 0 right-margin)
1770 ,reserve))) 1699 ,reserve)))
1771 'face '(:inherit simple-modeline-space)) 1700 'face '(:inherit simple-modeline-space))
1772 right)))) 1701 right))))
1773 1702
1774 (simple-modeline-mode +1)) 1703 (simple-modeline-mode +1))
1775 1704
@@ -1780,7 +1709,7 @@ browser defined in `browse-url-secondary-browser-function'."
1780 ("/authorized_keys2?\\'" . ssh-authorized-keys-mode))) 1709 ("/authorized_keys2?\\'" . ssh-authorized-keys-mode)))
1781 (add-to-list 'auto-mode-alist spec)) 1710 (add-to-list 'auto-mode-alist spec))
1782 1711
1783 (add-hook 'ssh-config-mode-hook #'turn-on-font-lock)) 1712 (:hook #'turn-on-font-lock))
1784 1713
1785(setup (:straight typo) 1714(setup (:straight typo)
1786 1715
@@ -1799,28 +1728,24 @@ browser defined in `browse-url-secondary-browser-function'."
1799 (or (buffer-name) ""))) 1728 (or (buffer-name) "")))
1800 (typo-mode +1)))) 1729 (typo-mode +1))))
1801 1730
1802 (with-eval-after-load 'typo 1731 ;; jlf & cvandusen on #emacs make a great point: ’ (RIGHT SINGLE QUOTATION
1803 ;; jlf & cvandusen on #emacs make a great point: ’ (RIGHT SINGLE QUOTATION 1732 ;; MARK) is /not/ an apostrophe. Making it curly is a typographical
1804 ;; MARK) is /not/ an apostrophe. Making it curly is a typographical 1733 ;; consideration, not an input consideration. (I suppose you could make
1805 ;; consideration, not an input consideration. (I suppose you could make 1734 ;; the argument that all of these are typographical considerations, but
1806 ;; the argument that all of these are typographical considerations, but 1735 ;; .. bleh.)
1807 ;; .. bleh.)
1808 (define-typo-cycle typo-cycle-apostrophe
1809 "Cycle through apostrophe-like graphemes.
1810If used with a numeric prefix argument N, N apostrophes will be inserted."
1811 ("'" "′" "″" "’"))
1812 1736
1813 (define-typo-cycle typo-cycle-backtick 1737 (:bind "'" (define-typo-cycle typo-cycle-apostrophe
1814 "Cycle through backtick and left single quotation mark. 1738 "Cycle through apostrophe-like graphemes.
1739If used with a numeric prefix argument N, N apostrophes will be inserted."
1740 ("'" "′" "″" "’"))
1741 "`" (define-typo-cycle typo-cycle-backtick
1742 "Cycle through backtick and left single quotation mark.
1815If used with a numeric prefix argument N, N backticks will be inserted." 1743If used with a numeric prefix argument N, N backticks will be inserted."
1816 ("`" "‘")) 1744 ("`" "‘"))))
1817
1818 (:bind "'" typo-cycle-apostrophe
1819 "`" typo-cycle-backtick)))
1820 1745
1821(setup (:straight undo-fu) 1746(setup (:straight undo-fu)
1822 (:global "C-/" undo-fu-only-undo 1747 (:global "C-/" #'undo-fu-only-undo
1823 "C-?" undo-fu-only-redo)) 1748 "C-?" #'undo-fu-only-redo))
1824 1749
1825(setup (:straight undo-fu-session) 1750(setup (:straight undo-fu-session)
1826 (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" 1751 (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'"
@@ -1833,38 +1758,33 @@ If used with a numeric prefix argument N, N backticks will be inserted."
1833(setup (:straight unfill)) 1758(setup (:straight unfill))
1834 1759
1835(setup (:straight visual-regexp) 1760(setup (:straight visual-regexp)
1836 (:global "M-%" vr/query-replace)) 1761 (:global "M-%" #'vr/query-replace))
1837 1762
1838(setup (:straight wc-mode) ; TODO: move some of this stuff around 1763(setup (:straight wc-mode) ; TODO: move some of this stuff around
1839 1764
1840 (:option wc-modeline-format "[%tww]" 1765 (:option wc-modeline-format "[%tww]"
1841 wc-idle-wait 2) 1766 wc-idle-wait 2)
1842 1767
1843 (:hook-into text-mode) 1768 (:hook-into text-mode))
1844
1845 (defun acdw-modeline/wc ()
1846 "Display current `wc-buffer-stats'."
1847 (when (bound-and-true-p wc-mode)
1848 (or wc-buffer-stats "[w]"))))
1849 1769
1850(setup (:straight web-mode) 1770(setup (:straight web-mode)
1851 (:option css-level-offset 2 1771 (:option css-level-offset 2
1852 js-indent-level 2 1772 js-indent-level 2
1853 sgml-indent-offset 2) 1773 sgml-indent-offset 2)
1854 1774
1855 (dolist (ext '("\\.\\(p\\|dj\\)?html\\'" 1775 (:file-match "\\.\\(p\\|dj\\)?html\\'"
1856 "\\.html?\\'" 1776 "\\.html?\\'"
1857 "\\.\\(tpl\\.\\)?php\\'" 1777 "\\.\\(tpl\\.\\)?php\\'"
1858 "\\.[agj]sp\\'" 1778 "\\.[agj]sp\\'"
1859 "\\.as[cp]x\\'" 1779 "\\.as[cp]x\\'"
1860 "\\.erb\\'" 1780 "\\.erb\\'"
1861 "\\.mustache\\'")) 1781 "\\.mustache\\'"))
1862 (add-to-list 'auto-mode-alist `(,ext . web-mode))))
1863 1782
1864(setup (:straight which-key) 1783(setup (:straight which-key)
1865 (:option which-key-show-early-on-C-h t 1784 (:option which-key-show-early-on-C-h t
1866 which-key-idle-delay 1 1785 which-key-idle-delay 1
1867 which-key-idle-secondary-delay 0.5) 1786 which-key-idle-secondary-delay 0.5
1787 which-key-sort-order 'which-key-prefix-then-key-order)
1868 1788
1869 (:global "C-h m" #'which-key-show-major-mode) 1789 (:global "C-h m" #'which-key-show-major-mode)
1870 1790
@@ -1886,16 +1806,16 @@ If used with a numeric prefix argument N, N backticks will be inserted."
1886 (when (and (not winum--keys-mapped) 1806 (when (and (not winum--keys-mapped)
1887 (display-graphic-p)) 1807 (display-graphic-p))
1888 (:with-map winum-keymap 1808 (:with-map winum-keymap
1889 (:bind "M-0" winum-select-window-0-or-10 1809 (:bind "M-0" #'winum-select-window-0-or-10
1890 "M-1" winum-select-window-1 1810 "M-1" #'winum-select-window-1
1891 "M-2" winum-select-window-2 1811 "M-2" #'winum-select-window-2
1892 "M-3" winum-select-window-3 1812 "M-3" #'winum-select-window-3
1893 "M-4" winum-select-window-4 1813 "M-4" #'winum-select-window-4
1894 "M-5" winum-select-window-5 1814 "M-5" #'winum-select-window-5
1895 "M-6" winum-select-window-6 1815 "M-6" #'winum-select-window-6
1896 "M-7" winum-select-window-7 1816 "M-7" #'winum-select-window-7
1897 "M-8" winum-select-window-8 1817 "M-8" #'winum-select-window-8
1898 "M-9" winum-select-window-9)) 1818 "M-9" #'winum-select-window-9))
1899 (setq winum--keys-mapped t))) 1819 (setq winum--keys-mapped t)))
1900 1820
1901 (winum-mode +1)) 1821 (winum-mode +1))
@@ -1903,21 +1823,20 @@ If used with a numeric prefix argument N, N backticks will be inserted."
1903(setup (:straight xr)) 1823(setup (:straight xr))
1904 1824
1905(setup (:straight zzz-to-char) 1825(setup (:straight zzz-to-char)
1906 (defun acdw/zzz-up-to-char (prefix) 1826
1907 "Call `zzz-up-to-char', unless issued a PREFIX, in which case 1827 (:global "M-z"
1908call `zzz-to-char'." 1828 (defun acdw/zzz-up-to-char (prefix)
1909 (interactive "P") 1829 "Call `zzz-up-to-char' or `zzz-to-char', PREFIX-depending."
1910 (if prefix 1830 (interactive "P")
1911 (call-interactively #'zzz-to-char) 1831 (if prefix
1912 (call-interactively #'zzz-up-to-char))) 1832 (call-interactively #'zzz-to-char)
1913 1833 (call-interactively #'zzz-up-to-char)))))
1914 (:global "M-z" acdw/zzz-up-to-char))
1915 1834
1916(setup (:straight-if (pdf-tools 1835(setup (:straight-if (pdf-tools
1917 :host github 1836 :host github
1918 :repo "vedang/pdf-tools") 1837 :repo "vedang/pdf-tools")
1919 (acdw/system :home)) 1838 (acdw/system :home))
1920 (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode)) 1839 (:file-match (rx ".pdf" eos))
1921 (pdf-loader-install)) 1840 (pdf-loader-install))
1922 1841
1923(setup (:straight-if affe 1842(setup (:straight-if affe
@@ -1925,11 +1844,10 @@ call `zzz-to-char'."
1925 (executable-find "find")) 1844 (executable-find "find"))
1926 (executable-find "rg"))) 1845 (executable-find "rg")))
1927 ;; Keys are bound in `acdw/sensible-grep' and `acdw/sensible-find' 1846 ;; Keys are bound in `acdw/sensible-grep' and `acdw/sensible-find'
1928 (defun affe-orderless-regexp-compiler (input _type) 1847 (:option affe-regexp-compiler
1929 (setq input (orderless-pattern-compiler input)) 1848 (defun affe-orderless-regexp-compiler (input _type)
1930 (cons input (lambda (str) (orderless--highlight input str)))) 1849 (setq input (orderless-pattern-compiler input))
1931 1850 (cons input (lambda (str) (orderless--highlight input str))))))
1932 (:option affe-regexp-compiler #'affe-orderless-regexp-compiler))
1933 1851
1934(setup (:straight-if ahk-mode 1852(setup (:straight-if ahk-mode
1935 (acdw/system :work))) 1853 (acdw/system :work)))
@@ -1969,9 +1887,9 @@ call `zzz-to-char'."
1969 "https://radio.tildeverse.org/radio/8000/radio.ogg") 1887 "https://radio.tildeverse.org/radio/8000/radio.ogg")
1970 ("vantaradio" . 1888 ("vantaradio" .
1971 "https://vantaa.black/radio"))) 1889 "https://vantaa.black/radio")))
1972 (:global "C-c r r" eradio-play ; mnemonic: radio 1890 (:global "C-c r r" #'eradio-play ; mnemonic: radio
1973 "C-c r s" eradio-stop ; mnemonic: stop 1891 "C-c r s" #'eradio-stop ; mnemonic: stop
1974 "C-c r p" eradio-toggle ; mnemonic: play/pause 1892 "C-c r p" #'eradio-toggle ; mnemonic: play/pause
1975 )) 1893 ))
1976 1894
1977(setup (:straight-if exec-path-from-shell 1895(setup (:straight-if exec-path-from-shell
@@ -1982,17 +1900,17 @@ call `zzz-to-char'."
1982(setup (:straight-if fennel-mode 1900(setup (:straight-if fennel-mode
1983 (executable-find "fennel")) 1901 (executable-find "fennel"))
1984 (autoload 'fennel-repl "fennel-mode" nil t) 1902 (autoload 'fennel-repl "fennel-mode" nil t)
1985 (add-to-list 'auto-mode-alist '("\\.fnl\\'" . fennel-mode))) 1903 (:file-match (rx ".fnl" eos)))
1986 1904
1987(setup (:straight-if geiser 1905(setup (:straight-if geiser
1988 (progn 1906 (progn
1989 (defvar acdw/schemes 1907 (defvar acdw/schemes
1990 (let (schemes) ; these binaries should be checked... 1908 (let (schemes)
1991 (dolist (scheme '(("scheme" . geiser-chez) ; chez 1909 (dolist (scheme '(("scheme" . geiser-chez) ; chez
1992 ("petite" . geiser-chez) ; petite 1910 ("petite" . geiser-chez) ; petite
1993 ("csi" . geiser-chez) ; chicken 1911 ("csi" . geiser-chez) ; chicken
1994 ("gsi" . geiser-gambit) ; gambit 1912 ("gsi" . geiser-gambit)
1995 ("gosh" . geiser-gauche) ; gauche 1913 ("gosh" . geiser-gauche)
1996 ("guile" . geiser-guile) 1914 ("guile" . geiser-guile)
1997 ("kawa" . geiser-kawa) 1915 ("kawa" . geiser-kawa)
1998 ("mit-scheme" . geiser-mit) 1916 ("mit-scheme" . geiser-mit)
@@ -2003,31 +1921,32 @@ call `zzz-to-char'."
2003 ;; and install the proper helper package 1921 ;; and install the proper helper package
2004 (straight-use-package (cdr scheme)))) 1922 (straight-use-package (cdr scheme))))
2005 (nreverse schemes))) 1923 (nreverse schemes)))
2006 acdw/schemes))) 1924 acdw/schemes))
1925 (:file-match (rx ".rkt" eos)
1926 (rx ".scm" eos)))
2007 1927
2008(setup (:straight-if ledger-mode 1928(setup (:straight-if ledger-mode
2009 (executable-find "ledger"))) 1929 (executable-find "ledger")))
2010 1930
2011(setup (:straight-if pkgbuild-mode 1931(setup (:straight-if pkgbuild-mode
2012 (executable-find "makepkg"))) 1932 (executable-find "makepkg"))
1933 (:file-match "PKGBUILD"))
2013 1934
2014(setup (:straight-if sly 1935(setup (:straight-if sly
2015 (progn (defvar acdw/lisp-bin 1936 (progn
2016 (or (executable-find "sbcl") 1937 (defvar acdw/lisps
2017 (executable-find "clisp") 1938 (let (lisps)
2018 "")) 1939 (dolist (lisp '("sbcl" ; TODO: add more lisps
2019 (executable-find acdw/lisp-bin))) 1940 "clisp"))
2020 1941 (when-let (binary (executable-find lisp))
1942 (push binary lisps)))
1943 (nreverse lisps)))
1944 acdw/lisps))
1945 (:also-load sly-autoloads)
1946 (:straight clhs)
1947
2021 (:option inferior-lisp-program acdw/lisp-bin 1948 (:option inferior-lisp-program acdw/lisp-bin
2022 sly-kill-without-query-p t) 1949 sly-kill-without-query-p t)
2023
2024 (:also-load sly-autoloads)
2025 (setup (:straight clhs))
2026
2027 (:with-feature sly-mrepl
2028 (dolist (key '("RET" "<return>"))
2029 (:bind key sly-mrepl-return-at-end))
2030 (:bind "C-c C-c" sly-mrepl-return))
2031 1950
2032 (defun sly-mrepl-return-at-end () 1951 (defun sly-mrepl-return-at-end ()
2033 (interactive) 1952 (interactive)
@@ -2035,7 +1954,12 @@ call `zzz-to-char'."
2035 (sly-mrepl-return) 1954 (sly-mrepl-return)
2036 (if (bound-and-true-p paredit-mode) 1955 (if (bound-and-true-p paredit-mode)
2037 (paredit-newline) 1956 (paredit-newline)
2038 (electric-newline-and-maybe-indent))))) 1957 (electric-newline-and-maybe-indent))))
1958
1959 (:with-feature sly-mrepl
1960 (dolist (key '("RET" "<return>"))
1961 (:bind key #'sly-mrepl-return-at-end))
1962 (:bind "C-c C-c" #'sly-mrepl-return)))
2039 1963
2040(setup (:straight-if systemd 1964(setup (:straight-if systemd
2041 (executable-find "systemd"))) 1965 (executable-find "systemd")))
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 44bb889..5aa0a18 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -173,6 +173,11 @@ is, if point < mark."
173 (if-let ((backend (vc-backend buffer-file-name))) 173 (if-let ((backend (vc-backend buffer-file-name)))
174 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2)))) 174 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))
175 175
176(defun acdw-modeline/wc ()
177 "Display current `wc-buffer-stats'."
178 (when (bound-and-true-p wc-mode)
179 (or wc-buffer-stats "[w]")))
180
176(defun acdw-modeline/winum () 181(defun acdw-modeline/winum ()
177 "Show the `winum' number of the current window in the modeline. 182 "Show the `winum' number of the current window in the modeline.
178Only shows if there is more than one window." 183Only shows if there is more than one window."