diff options
author | Case Duckworth | 2021-09-04 23:57:04 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-04 23:57:04 -0500 |
commit | fd3d5fc55f5e537bd4da19ada52486eb70e6bf11 (patch) | |
tree | 28ce11a7f596b88a30dc3ecbb22d9159baa25d8d | |
parent | Quit buffers after /PART, /QUIT, /GQUIT (diff) | |
download | emacs-fd3d5fc55f5e537bd4da19ada52486eb70e6bf11.tar.gz emacs-fd3d5fc55f5e537bd4da19ada52486eb70e6bf11.zip |
Mostly keywording stuff
I messed up my commits here... bah
-rw-r--r-- | init.el | 477 | ||||
-rw-r--r-- | lisp/acdw-consult.el | 26 |
2 files changed, 247 insertions, 256 deletions
diff --git a/init.el b/init.el index 80fb0cc..dceb56f 100644 --- a/init.el +++ b/init.el | |||
@@ -125,13 +125,13 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
125 | (setup browse-url | 125 | (setup browse-url |
126 | (:require acdw-browse-url) | 126 | (:require acdw-browse-url) |
127 | 127 | ||
128 | (setq-default browse-url-secondary-browser-function | 128 | (:option browse-url-secondary-browser-function |
129 | (if (executable-find "firefox") ; prefer Firefox | 129 | (if (executable-find "firefox") ; prefer Firefox |
130 | #'browse-url-firefox | 130 | #'browse-url-firefox |
131 | #'browse-url-default-browser) | 131 | #'browse-url-default-browser) |
132 | browse-url-new-window-flag nil ; for eww | 132 | browse-url-new-window-flag nil ; for eww |
133 | browse-url-firefox-arguments '("--new-tab") ; for firefox | 133 | browse-url-firefox-arguments '("--new-tab") ; for firefox |
134 | browse-url-firefox-new-window-is-tab t) | 134 | browse-url-firefox-new-window-is-tab t) |
135 | 135 | ||
136 | (acdw/browse-url-set-handlers | 136 | (acdw/browse-url-set-handlers |
137 | (list | 137 | (list |
@@ -222,9 +222,8 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
222 | circe-reduce-lurker-spam t | 222 | circe-reduce-lurker-spam t |
223 | circe-server-auto-join-default-type :after-auth) | 223 | circe-server-auto-join-default-type :after-auth) |
224 | 224 | ||
225 | (custom-set-faces '(circe-nick-highlight-face | 225 | (:face circe-nick-highlight-face |
226 | ((t (:inherit (modus-themes-hl-line)))) | 226 | ((t (:inherit (modus-themes-hl-line))))) |
227 | :now)) | ||
228 | 227 | ||
229 | (:bind "C-c C-p" #'circe-command-PART) | 228 | (:bind "C-c C-p" #'circe-command-PART) |
230 | 229 | ||
@@ -248,18 +247,19 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
248 | 247 | ||
249 | (:with-mode circe-chat-mode | 248 | (:with-mode circe-chat-mode |
250 | (:hook #'acdw/stop-paren-annoyances | 249 | (:hook #'acdw/stop-paren-annoyances |
251 | (defun circe-chat@setup () | 250 | #'enable-circe-color-nicks |
251 | #'enable-circe-display-images | ||
252 | #'enable-circe-new-day-notifier | ||
253 | (defun circe-chat@set-prompt () | ||
252 | (lui-set-prompt | 254 | (lui-set-prompt |
253 | (concat (propertize (acdw-irc/margin-format (buffer-name) | 255 | (concat |
254 | "" | 256 | (propertize |
255 | ">") | 257 | (acdw-irc/margin-format (buffer-name) "" ">") |
256 | 'face 'circe-prompt-face | 258 | 'face 'circe-prompt-face |
257 | 'read-only t 'intangible t | 259 | 'read-only t |
258 | 'cursor-intangible t) | 260 | 'intangible t |
259 | " ")) | 261 | 'cursor-intangible t) |
260 | (enable-circe-color-nicks) | 262 | " "))))) |
261 | (enable-circe-display-images) | ||
262 | (enable-circe-new-day-notifier)))) | ||
263 | 263 | ||
264 | (autoload 'circe-nick-color-reset "circe-color-nicks") | 264 | (autoload 'circe-nick-color-reset "circe-color-nicks") |
265 | (add-hook 'modus-themes-after-load-theme-hook | 265 | (add-hook 'modus-themes-after-load-theme-hook |
@@ -272,16 +272,15 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
272 | lui-time-stamp-format "%H:%M" | 272 | lui-time-stamp-format "%H:%M" |
273 | lui-track-behavior 'before-switch-to-buffer | 273 | lui-track-behavior 'before-switch-to-buffer |
274 | lui-track-indicator 'fringe) | 274 | lui-track-indicator 'fringe) |
275 | |||
276 | (:local-set fringes-outside-margins t | ||
277 | right-margin-width 5 | ||
278 | scroll-margin 0 | ||
279 | word-wrap t | ||
280 | wrap-prefix (repeat-string acdw-irc/left-margin " ") | ||
281 | line-number-mode nil) | ||
275 | 282 | ||
276 | (:hook (defun lui-mode@setup () | 283 | (:hook #'enable-lui-track))) |
277 | (setq-local fringes-outside-margins t | ||
278 | right-margin-width 5 | ||
279 | scroll-margin 0 | ||
280 | word-wrap t | ||
281 | wrap-prefix (repeat-string | ||
282 | acdw-irc/left-margin " ") | ||
283 | line-number-mode nil) | ||
284 | (enable-lui-track))))) | ||
285 | 284 | ||
286 | (setup completion | 285 | (setup completion |
287 | (:option completion-ignore-case t | 286 | (:option completion-ignore-case t |
@@ -296,10 +295,10 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
296 | (setup (:straight (consult | 295 | (setup (:straight (consult |
297 | :host github | 296 | :host github |
298 | :repo "minad/consult")) | 297 | :repo "minad/consult")) |
299 | (require 'acdw-consult) | 298 | |
300 | 299 | (:require acdw-consult) | |
301 | (setq consult--regexp-compiler #'consult--orderless-regexp-compiler) | 300 | (:autoload consult-register-preview) |
302 | 301 | ||
303 | ;; Bindings | 302 | ;; Bindings |
304 | (:global | 303 | (:global |
305 | ;; C-c bindings (`mode-specific-map') | 304 | ;; C-c bindings (`mode-specific-map') |
@@ -344,32 +343,6 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
344 | "M-s e" #'consult-isearch | 343 | "M-s e" #'consult-isearch |
345 | "M-s l" #'consult-line)) | 344 | "M-s l" #'consult-line)) |
346 | 345 | ||
347 | ;; see https://github.com/oantolin/completing-history | ||
348 | (defmacro consult-history-to-modes (map-hook-alist) | ||
349 | (let (defuns) | ||
350 | (dolist (map-hook map-hook-alist) | ||
351 | (let ((map-name (symbol-name (car map-hook))) | ||
352 | (key-defs `(progn (define-key | ||
353 | ,(car map-hook) | ||
354 | (kbd "M-r") | ||
355 | (function consult-history)) | ||
356 | (define-key ,(car map-hook) | ||
357 | (kbd "M-s") nil)))) | ||
358 | (push (if (cdr map-hook) | ||
359 | `(add-hook ',(cdr map-hook) | ||
360 | (defun | ||
361 | ,(intern (concat map-name | ||
362 | "@consult-history-bind")) | ||
363 | nil | ||
364 | ,(concat | ||
365 | "Bind `consult-history' to M-r in " | ||
366 | map-name ".\n" | ||
367 | "Defined by `consult-history-to-modes'.") | ||
368 | ,key-defs)) | ||
369 | key-defs) | ||
370 | defuns))) | ||
371 | `(progn ,@ (nreverse defuns)))) | ||
372 | |||
373 | (consult-history-to-modes ((minibuffer-local-map . nil) | 346 | (consult-history-to-modes ((minibuffer-local-map . nil) |
374 | (shell-mode-map . shell-mode-hook) | 347 | (shell-mode-map . shell-mode-hook) |
375 | (term-mode-map . term-mode-hook) | 348 | (term-mode-map . term-mode-hook) |
@@ -377,47 +350,38 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
377 | (comint-mode-map . comint-mode-hook) | 350 | (comint-mode-map . comint-mode-hook) |
378 | (sly-mrepl-mode-map . sly-mrepl-hook))) | 351 | (sly-mrepl-mode-map . sly-mrepl-hook))) |
379 | 352 | ||
380 | |||
381 | |||
382 | ;; Registers | ||
383 | (:autoload consult-register-preview) | ||
384 | (:option register-preview-delay 0 | 353 | (:option register-preview-delay 0 |
385 | register-preview-function #'consult-register-format) | 354 | register-preview-function #'consult-register-format |
386 | (:advise register-preview :override #'consult-register-window) | 355 | xref-show-xrefs-function #'consult-xref |
387 | 356 | xref-show-definitions-function #'consult-xref | |
388 | ;; Xref | 357 | consult-project-root-function #'vc-root-dir |
389 | (:option xref-show-xrefs-function #'consult-xref | 358 | completion-in-region-function #'acdw-consult/complete-in-region |
390 | xref-show-definitions-function #'consult-xref) | ||
391 | |||
392 | ;; Projects | ||
393 | (:option consult-project-root-function #'vc-root-dir) | ||
394 | |||
395 | ;; Competion-at-point (complete-region) | ||
396 | (:option completion-in-region-function #'acdw-consult/complete-in-region | ||
397 | completion-cycle-threshold 3 | 359 | completion-cycle-threshold 3 |
398 | tab-always-indent 'complete) | 360 | tab-always-indent 'complete) |
399 | 361 | ||
362 | (:advise register-preview :override #'consult-register-window) | ||
363 | |||
400 | ;; Completing-read-multple | 364 | ;; Completing-read-multple |
401 | (if (fboundp #'consult-completing-read-multiple) | 365 | (if (fboundp #'consult-completing-read-multiple) |
402 | (:advise completing-read-multple | 366 | (:advise completing-read-multple :override |
403 | :override #'consult-completing-read-multiple) | 367 | #'consult-completing-read-multiple) |
404 | ;; else | 368 | (:advise completing-read-multiple :filter-args |
405 | (defun crm-indicator (args) | 369 | (defun crm-indicator (args) |
406 | (cons (concat "[CRM] " (car args)) (cdr args))) | 370 | (cons (concat "[CRM] " (car args)) (cdr args))))) |
407 | (:advise completing-read-multiple | 371 | |
408 | :filter-args #'crm-indicator)) | 372 | (with-eval-after-load 'orderless |
409 | 373 | (:option consult--regexp-compiler | |
374 | #'consult--orderless-regexp-compiler)) | ||
375 | |||
410 | (with-eval-after-loads (vertico consult) | 376 | (with-eval-after-loads (vertico consult) |
411 | (when (boundp 'consult-crm-map) | 377 | (:with-map consult-crm-map |
412 | (define-key consult-crm-map "\r" #'+vertico-crm-exit) | 378 | (:bind "RET" (defun +vertico-crm-exit () |
413 | (define-key consult-crm-map "\t" #'vertico-exit) | 379 | (interactive) |
414 | (defun +vertico-crm-exit () | 380 | (run-at-time 0 nil #'vertico-exit) |
415 | (interactive) | 381 | (funcall #'vertico-exit)) |
416 | (run-at-time 0 nil #'vertico-exit) | 382 | "TAB" #'vertico-exit)))) |
417 | (funcall #'vertico-exit))))) | ||
418 | 383 | ||
419 | (setup (:straight crux) | 384 | (setup (:straight crux) |
420 | |||
421 | (:global "C-x o" #'acdw/other-window-or-switch-buffer | 385 | (:global "C-x o" #'acdw/other-window-or-switch-buffer |
422 | "C-o" #'crux-smart-open-line | 386 | "C-o" #'crux-smart-open-line |
423 | "M-o" #'crux-smart-open-line-above | 387 | "M-o" #'crux-smart-open-line-above |
@@ -425,9 +389,8 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
425 | "C-x 4 t" #'crux-transpose-windows) | 389 | "C-x 4 t" #'crux-transpose-windows) |
426 | 390 | ||
427 | (when (fboundp 'repeat-mode) | 391 | (when (fboundp 'repeat-mode) |
428 | (unless (boundp 'other-window-repeat-map) | 392 | (defvar other-window-repeat-map (make-sparse-keymap) |
429 | (defvar other-window-repeat-map (make-sparse-keymap) | 393 | "A map for repeating `other-window' keys.") |
430 | "A map for repeating `other-window' keys.")) | ||
431 | 394 | ||
432 | (define-key other-window-repeat-map "o" | 395 | (define-key other-window-repeat-map "o" |
433 | #'acdw/other-window-or-switch-buffer) | 396 | #'acdw/other-window-or-switch-buffer) |
@@ -475,37 +438,34 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
475 | nil)))) | 438 | nil)))) |
476 | 439 | ||
477 | (:with-mode Custom-mode | 440 | (:with-mode Custom-mode |
478 | (:hook (defun custom-mode@imenu () ; thanks u/oantolin! | 441 | (:local-set imenu-generic-expression ; thanks u/oantolin! |
479 | "Build `imenu' for `Custom-mode'." | 442 | '(("Faces" (rx (seq bol |
480 | (setq | 443 | (or "Show" "Hide") " " |
481 | imenu-generic-expression | 444 | (group (zero-or-more nonl)) |
482 | '(("Faces" (rx (seq bol | 445 | " face: [sample]")) |
483 | (or "Show" "Hide") " " | 446 | 1) |
484 | (group (zero-or-more nonl)) | 447 | ("Variables" (rx (seq bol |
485 | " face: [sample]")) | 448 | (or "Show Value" "Hide") " " |
486 | 1) | 449 | (group (zero-or-more |
487 | ("Variables" (rx (seq bol | 450 | (not (any "\n:")))))) |
488 | (or "Show Value" "Hide") " " | 451 | 1))))) |
489 | (group (zero-or-more | ||
490 | (not (any "\n:")))))) | ||
491 | 1))))))) | ||
492 | 452 | ||
493 | (setup debugger | 453 | (setup debugger |
494 | (:hook visual-line-mode)) | 454 | (:hook visual-line-mode)) |
495 | 455 | ||
496 | (setup dired | 456 | (setup dired |
497 | (:also-load dired-x) | 457 | (:also-load dired-x) |
498 | (setq-default dired-recursive-copies 'always | 458 | (:option dired-recursive-copies 'always |
499 | dired-recursive-deletes 'always | 459 | dired-recursive-deletes 'always |
500 | delete-by-moving-to-trash t | 460 | delete-by-moving-to-trash t |
501 | dired-listing-switches "-Al" | 461 | dired-listing-switches "-Al" |
502 | ls-lisp-dirs-first t | 462 | ls-lisp-dirs-first t |
503 | dired-ls-F-marks-symlinks t | 463 | dired-ls-F-marks-symlinks t |
504 | dired-no-confirm '(byte-compile | 464 | dired-no-confirm '(byte-compile |
505 | chgrp chmod chown copy | 465 | chgrp chmod chown copy |
506 | hardlink load move | 466 | hardlink load move |
507 | shell touch symlink) | 467 | shell touch symlink) |
508 | dired-dwim-target t) | 468 | dired-dwim-target t) |
509 | 469 | ||
510 | (:hook dired-hide-details-mode | 470 | (:hook dired-hide-details-mode |
511 | hl-line-mode) | 471 | hl-line-mode) |
@@ -614,6 +574,12 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
614 | :host "mf.acdw.net")))) | 574 | :host "mf.acdw.net")))) |
615 | 575 | ||
616 | (elfeed-protocol-enable) | 576 | (elfeed-protocol-enable) |
577 | (:advise elfeed :after | ||
578 | (defun elfeed@protocol-update (&rest _) | ||
579 | (elfeed-search-fetch nil))) | ||
580 | |||
581 | (:face message-header-subject | ||
582 | ((t (:height 1.5)))) | ||
617 | 583 | ||
618 | (:with-mode elfeed-show-mode | 584 | (:with-mode elfeed-show-mode |
619 | (:hook (defun elfeed-show@setup () | 585 | (:hook (defun elfeed-show@setup () |
@@ -641,16 +607,17 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
641 | lisp-indent-function #'lisp-indent-function) | 607 | lisp-indent-function #'lisp-indent-function) |
642 | 608 | ||
643 | (:with-mode emacs-lisp-mode | 609 | (:with-mode emacs-lisp-mode |
644 | (:hook #'checkdoc-minor-mode | 610 | (:local-set lexical-binding t |
645 | #'turn-on-eldoc-mode | 611 | (append imenu-generic-expression) |
646 | 612 | `("Setup" | |
647 | (defun emacs-lisp@enforce-lexical-binding () | 613 | ,(rx (seq |
648 | (setq-local lexical-binding t)) | 614 | (group bol (* space) "(setup" (+ space)) |
615 | (? (group "(:" (+ graph) (* space) (? "("))) | ||
616 | (group (+ (any word ?-))))) | ||
617 | 3)) | ||
649 | 618 | ||
650 | (defun emacs-lisp@imenu-add-setup () | 619 | (:hook #'checkdoc-minor-mode |
651 | (:option (append imenu-generic-expression) | 620 | #'turn-on-eldoc-mode) |
652 | '("Setup" | ||
653 | "\\(^\\s-*(setup +(?\\)\\(\\_<.+\\_>\\)" 2)))) | ||
654 | 621 | ||
655 | ;; Emulate slime's eval binds | 622 | ;; Emulate slime's eval binds |
656 | (:bind "C-c C-c" #'eval-defun | 623 | (:bind "C-c C-c" #'eval-defun |
@@ -661,7 +628,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
661 | (:advise eval-region :around | 628 | (:advise eval-region :around |
662 | (defun eval-region@pulse (fn beg end &rest args) | 629 | (defun eval-region@pulse (fn beg end &rest args) |
663 | (pulse-momentary-highlight-region beg end) | 630 | (pulse-momentary-highlight-region beg end) |
664 | (apply fn start end args)))) | 631 | (apply fn beg end args)))) |
665 | 632 | ||
666 | (setup (:straight elisp-slime-nav) | 633 | (setup (:straight elisp-slime-nav) |
667 | (:hook-into emacs-lisp-mode | 634 | (:hook-into emacs-lisp-mode |
@@ -679,7 +646,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
679 | "o" #'elpher-follow-current-link | 646 | "o" #'elpher-follow-current-link |
680 | "G" #'elpher-go-current) | 647 | "G" #'elpher-go-current) |
681 | 648 | ||
682 | (:hook acdw/reading-mode) | 649 | (:hook #'acdw/reading-mode) |
683 | 650 | ||
684 | (:autoload (elpher-bookmarks :interactive t) | 651 | (:autoload (elpher-bookmarks :interactive t) |
685 | (elpher-go :interactive t)) | 652 | (elpher-go :interactive t)) |
@@ -692,22 +659,99 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
692 | ;; (t (apply fn url args)))) | 659 | ;; (t (apply fn url args)))) |
693 | ) | 660 | ) |
694 | 661 | ||
662 | (setup emacs | ||
663 | ;; "Et cetera" settings | ||
664 | ;; This should stay as /minimal/ as possible. Anything that can go somewhere | ||
665 | ;; else /should/ go there. | ||
666 | (:option | ||
667 | attempt-orderly-shutdown-on-fatal-signal nil | ||
668 | attempt-stack-overflow-recovery nil | ||
669 | echo-keystrokes 0.01 | ||
670 | find-function-C-source-directory (acdw/find-emacs-source) | ||
671 | kill-read-only-ok t | ||
672 | load-prefer-newer t | ||
673 | native-comp-async-report-warnings-errors nil | ||
674 | set-mark-command-repeat-pop t) | ||
675 | |||
676 | (when (fboundp 'command-completion-default-include-p) | ||
677 | (setq read-extended-command-predicate | ||
678 | #'command-completion-default-include-p)) | ||
679 | |||
680 | (defvar case-map (make-sparse-keymap) | ||
681 | "A keymap for setting case in various ways.") | ||
682 | (global-set-key (kbd "C-c c") case-map) | ||
683 | |||
684 | (defvar lookup-map (make-sparse-keymap) | ||
685 | "A keymap for looking up things.") | ||
686 | (global-set-key (kbd "C-c l") lookup-map) | ||
687 | |||
688 | (:global "M-=" #'count-words | ||
689 | "C-w" #'kill-region-or-backward-word | ||
690 | "C-c c c" #'capitalize-dwim | ||
691 | "C-c c t" #'titlecase-dwim | ||
692 | "C-c c u" #'upcase-dwim | ||
693 | "C-c c l" #'downcase-dwim | ||
694 | "C-c d" #'acdw/insert-iso-date | ||
695 | "M-`" nil) | ||
696 | |||
697 | ;; toggle bindings | ||
698 | (defvar toggle-map (make-sparse-keymap) | ||
699 | "A keymap for toggling!") | ||
700 | (global-set-key (kbd "C-c t") toggle-map) | ||
701 | |||
702 | (:with-map toggle-map | ||
703 | (:bind "c" #'column-number-mode | ||
704 | "l" #'display-line-numbers-mode | ||
705 | "d" #'toggle-debug-on-error)) | ||
706 | |||
707 | (defalias 'forward-word-with-case 'forward-word | ||
708 | "Alias for `forward-word' for use in `case-repeat-map'.") | ||
709 | (defalias 'backward-word-with-case 'backward-word | ||
710 | "Alias for `backward-word for use in `case-repeat-map'.") | ||
711 | |||
712 | (defvar case-repeat-map | ||
713 | (let ((map (make-sparse-keymap))) | ||
714 | (define-key map "c" #'capitalize-word) | ||
715 | (define-key map "u" #'upcase-word) | ||
716 | (define-key map "l" #'downcase-word) | ||
717 | ;; movement | ||
718 | (define-key map "f" #'forward-word-with-case) | ||
719 | (define-key map "b" #'backward-word-with-case) | ||
720 | map) | ||
721 | "A map to repeat word-casing commands. For use with `repeat-mode'.") | ||
722 | |||
723 | (dolist (command '(capitalize-word | ||
724 | capitalize-dwim | ||
725 | upcase-word | ||
726 | upcase-dwim | ||
727 | downcase-word | ||
728 | downcase-dwim | ||
729 | forward-word-with-case | ||
730 | backward-word-with-case)) | ||
731 | (put command 'repeat-map 'case-repeat-map)) | ||
732 | |||
733 | (add-hook 'after-make-frame-functions | ||
734 | (defun after-make-frame@maximize (frame) | ||
735 | (unless (bound-and-true-p edit-server-frame-p) | ||
736 | (toggle-frame-maximized frame))))) | ||
737 | |||
695 | (setup (:straight embark) | 738 | (setup (:straight embark) |
696 | (:global "C-." #'embark-act) | 739 | (:global "C-." #'embark-act) |
697 | (:option prefix-help-command #'embark-prefix-help-command | 740 | (:option prefix-help-command #'embark-prefix-help-command |
698 | (append display-buffer-alist) | 741 | (append display-buffer-alist) |
699 | '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" | 742 | `(,(rx (seq bos "*Embark Collect " |
743 | (group (| "Live" "Completions")) | ||
744 | "*")) | ||
700 | nil | 745 | nil |
701 | (window-parameters (mode-line-format . none))) | 746 | (window-parameters (mode-line-format . none))) |
702 | embark-prompter #'embark-keymap-prompter | 747 | embark-prompter #'embark-keymap-prompter |
703 | embark-verbose-indicator-display-action | 748 | embark-verbose-indicator-display-action |
704 | '(display-buffer-at-bottom (window-height . fit-window-to-buffer))) | 749 | '(display-buffer-at-bottom (window-height . fit-window-to-buffer)) |
705 | 750 | embark-action-indicator | |
706 | (setq embark-action-indicator | 751 | (lambda (map _target) |
707 | (lambda (map _target) | 752 | (which-key--show-keymap "Embark" map nil nil 'no-paging) |
708 | (which-key--show-keymap "Embark" map nil nil 'no-paging) | 753 | #'which-key--hide--ignore-command) |
709 | #'which-key--hide-popup-ignore-command) | 754 | embark-become-indicator embark-action-indicator) |
710 | embark-become-indicator embark-action-indicator) | ||
711 | 755 | ||
712 | (with-eval-after-loads (embark consult) | 756 | (with-eval-after-loads (embark consult) |
713 | (:straight embark-consult) | 757 | (:straight embark-consult) |
@@ -803,29 +847,24 @@ AKA, DO NOT USE THIS FUNCTION!!!" | |||
803 | eshell-smart-space-goes-to-end t | 847 | eshell-smart-space-goes-to-end t |
804 | eshell-where-to-jump 'begin) | 848 | eshell-where-to-jump 'begin) |
805 | 849 | ||
806 | (defun eshell-buffer-name () | 850 | ;; Make navigating amongst prompts easier |
807 | (rename-buffer (concat "*eshell*<" (eshell/pwd) ">") t)) | 851 | (:local-set outline-regexp eshell-prompt-regexp |
852 | page-delimiter eshell-prompt-regexp) | ||
808 | 853 | ||
809 | (add-hook 'eshell-directory-change-hook #'eshell-buffer-name) | 854 | (:bind "C-d" #'eshell-quit-or-delete-char) |
810 | (add-hook 'eshell-prompt-load-hook #'eshell-buffer-name) | ||
811 | 855 | ||
812 | (:hook eshell-arg-hist-mode | 856 | (:hook #'eshell-arg-hist-mode |
857 | |||
813 | (defun eshell-mode@setup () | 858 | (defun eshell-mode@setup () |
814 | ;; Define keys | ||
815 | (dolist (spec '(("C-d" . eshell-quit-or-delete-char))) | ||
816 | (define-key eshell-mode-map (kbd (car spec)) (cdr spec))) | ||
817 | ;; Fix modeline | 859 | ;; Fix modeline |
818 | (when (boundp 'simple-modeline--mode-line) | 860 | (when (boundp 'simple-modeline--mode-line) |
819 | (setq mode-line-format '(:eval simple-modeline--mode-line))) | 861 | (setq mode-line-format '(:eval simple-modeline--mode-line)))))) |
820 | ;; Make navigating amongst prompts easier | ||
821 | (setq-local outline-regexp eshell-prompt-regexp | ||
822 | page-delimiter eshell-prompt-regexp)))) | ||
823 | 862 | ||
824 | (setup eww | 863 | (setup eww |
825 | (:option eww-search-prefix "https://duckduckgo.com/html?q=" | 864 | (:option eww-search-prefix "https://duckduckgo.com/html?q=" |
826 | url-privacy-level '(email agent cookies lastloc)) | 865 | url-privacy-level '(email agent cookies lastloc)) |
827 | 866 | ||
828 | (:hook acdw/reading-mode)) | 867 | (:hook #'acdw/reading-mode)) |
829 | 868 | ||
830 | (setup (:straight-if exec-path-from-shell | 869 | (setup (:straight-if exec-path-from-shell |
831 | (acdw/system :home)) | 870 | (acdw/system :home)) |
@@ -877,11 +916,7 @@ successive invocations." | |||
877 | vc-make-backup-files t | 916 | vc-make-backup-files t |
878 | version-control t) | 917 | version-control t) |
879 | 918 | ||
880 | (auto-save-visited-mode +1) | 919 | (auto-save-visited-mode +1)) |
881 | |||
882 | (add-hook 'unfocused-hook | ||
883 | (defun unfocused@save-buffers () | ||
884 | (save-some-buffers t)))) | ||
885 | 920 | ||
886 | (setup find-func | 921 | (setup find-func |
887 | (:global "C-c l f" #'find-function | 922 | (:global "C-c l f" #'find-function |
@@ -905,9 +940,7 @@ successive invocations." | |||
905 | " %+%* GNU Emacs" | 940 | " %+%* GNU Emacs" |
906 | (:eval (when (frame-parameter nil 'client) | 941 | (:eval (when (frame-parameter nil 'client) |
907 | " Client"))) | 942 | " Client"))) |
908 | window-resize-pixelwise t) | 943 | window-resize-pixelwise t)) |
909 | |||
910 | (add-hook 'unfocused-hook #'garbage-collect)) | ||
911 | 944 | ||
912 | (setup (:straight gcmh) | 945 | (setup (:straight gcmh) |
913 | (:option gcmh-idle-delay 'auto) | 946 | (:option gcmh-idle-delay 'auto) |
@@ -1121,9 +1154,7 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1121 | (:file-match (rx ".lua" eos))) | 1154 | (:file-match (rx ".lua" eos))) |
1122 | 1155 | ||
1123 | (setup (:straight macrostep) | 1156 | (setup (:straight macrostep) |
1124 | 1157 | (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)) | |
1125 | (:with-mode emacs-lisp-mode | ||
1126 | (:bind "C-c e" #'macrostep-expand))) | ||
1127 | 1158 | ||
1128 | (setup (:straight magit) | 1159 | (setup (:straight magit) |
1129 | (:global "C-c g" #'magit-status) | 1160 | (:global "C-c g" #'magit-status) |
@@ -1182,7 +1213,10 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1182 | (minibuffer-depth-indicate-mode +1) | 1213 | (minibuffer-depth-indicate-mode +1) |
1183 | (file-name-shadow-mode +1) | 1214 | (file-name-shadow-mode +1) |
1184 | (minibuffer-electric-default-mode +1) | 1215 | (minibuffer-electric-default-mode +1) |
1185 | (fset 'yes-or-no-p #'y-or-n-p)) | 1216 | |
1217 | (if (version< emacs-version "28") | ||
1218 | (fset 'yes-or-no-p #'y-or-n-p) | ||
1219 | (setq use-short-answers t))) | ||
1186 | 1220 | ||
1187 | (setup (:straight (modus-themes | 1221 | (setup (:straight (modus-themes |
1188 | :host gitlab | 1222 | :host gitlab |
@@ -1418,6 +1452,7 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1418 | (mapc (lambda (buf) | 1452 | (mapc (lambda (buf) |
1419 | (with-current-buffer buf | 1453 | (with-current-buffer buf |
1420 | (when (funcall persistent-scratch-scratch-buffer-p-function) | 1454 | (when (funcall persistent-scratch-scratch-buffer-p-function) |
1455 | (setq lexical-binding t) | ||
1421 | (persistent-scratch-mode +1)))) | 1456 | (persistent-scratch-mode +1)))) |
1422 | (buffer-list))) | 1457 | (buffer-list))) |
1423 | 1458 | ||
@@ -1607,6 +1642,9 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1607 | acdw-modeline/narrowed | 1642 | acdw-modeline/narrowed |
1608 | acdw-modeline/major-mode))) | 1643 | acdw-modeline/major-mode))) |
1609 | 1644 | ||
1645 | (:option tab-bar-mode t | ||
1646 | tab-bar-show 1) | ||
1647 | |||
1610 | ;; I've put in a pull request to add the (- 0 right-margin) bit here. | 1648 | ;; I've put in a pull request to add the (- 0 right-margin) bit here. |
1611 | (:advise simple-modeline--format :override | 1649 | (:advise simple-modeline--format :override |
1612 | (defun simple-modeline@format (lefts rights) | 1650 | (defun simple-modeline@format (lefts rights) |
@@ -1727,7 +1765,12 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
1727 | (setup (:straight (unfocused | 1765 | (setup (:straight (unfocused |
1728 | :host github | 1766 | :host github |
1729 | :repo "duckwork/unfocused")) | 1767 | :repo "duckwork/unfocused")) |
1730 | (unfocused-mode +1)) | 1768 | (unfocused-mode +1) |
1769 | |||
1770 | (:with-hook unfocused-hook | ||
1771 | (:hook (defun unfocused@save-buffers () | ||
1772 | (save-some-buffers t)) | ||
1773 | #'garbage-collect))) | ||
1731 | 1774 | ||
1732 | (setup uniquify | 1775 | (setup uniquify |
1733 | (:option uniquify-buffer-name-style 'forward | 1776 | (:option uniquify-buffer-name-style 'forward |
@@ -1887,20 +1930,20 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
1887 | 1930 | ||
1888 | (setup window | 1931 | (setup window |
1889 | (require 'acdw-bell) | 1932 | (require 'acdw-bell) |
1890 | (:option Man-notify-method 'pushy | 1933 | (:option |
1891 | display-buffer-alist ; from FrostyX | 1934 | ;; Man-notify-method 'pushy |
1892 | '(("shell.*" (display-buffer-same-window) ()) | 1935 | ;; display-buffer-alist ; from FrostyX |
1893 | (".*" (display-buffer-reuse-window | 1936 | ;; '(("shell.*" (display-buffer-same-window) ()) |
1894 | display-buffer-same-window) | 1937 | ;; (".*" (display-buffer-reuse-window |
1895 | (reusable-frames . t))) | 1938 | ;; display-buffer-same-window) |
1896 | recenter-positions '(top middle bottom) | 1939 | ;; (reusable-frames . t))) |
1897 | ring-bell-function (lambda () | 1940 | recenter-positions '(top middle bottom) |
1898 | (acdw-bell/flash-mode-line | 1941 | ring-bell-function (lambda () |
1899 | (acdw/system :home))) | 1942 | (acdw-bell/flash-mode-line |
1900 | tab-bar-show 1 | 1943 | (acdw/system :home))) |
1901 | use-dialog-box nil | 1944 | use-dialog-box nil |
1902 | use-file-dialog nil | 1945 | use-file-dialog nil |
1903 | visible-bell nil) | 1946 | visible-bell nil) |
1904 | 1947 | ||
1905 | (tooltip-mode -1)) | 1948 | (tooltip-mode -1)) |
1906 | 1949 | ||
@@ -1951,82 +1994,6 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
1951 | 1994 | ||
1952 | (winum-mode +1)) | 1995 | (winum-mode +1)) |
1953 | 1996 | ||
1954 | (setup x-emacs | ||
1955 | ;; "Et cetera" settings | ||
1956 | ;; This should stay as /minimal/ as possible. Anything that can go somewhere | ||
1957 | ;; else /should/ go there. | ||
1958 | (:option | ||
1959 | attempt-orderly-shutdown-on-fatal-signal nil | ||
1960 | attempt-stack-overflow-recovery nil | ||
1961 | echo-keystrokes 0.01 | ||
1962 | find-function-C-source-directory (acdw/find-emacs-source) | ||
1963 | kill-read-only-ok t | ||
1964 | load-prefer-newer t | ||
1965 | native-comp-async-report-warnings-errors nil | ||
1966 | set-mark-command-repeat-pop t) | ||
1967 | |||
1968 | (when (fboundp 'command-completion-default-include-p) | ||
1969 | (setq read-extended-command-predicate | ||
1970 | #'command-completion-default-include-p)) | ||
1971 | |||
1972 | (defvar case-map (make-sparse-keymap) | ||
1973 | "A keymap for setting case in various ways.") | ||
1974 | (global-set-key (kbd "C-c c") case-map) | ||
1975 | |||
1976 | (defvar lookup-map (make-sparse-keymap) | ||
1977 | "A keymap for looking up things.") | ||
1978 | (global-set-key (kbd "C-c l") lookup-map) | ||
1979 | |||
1980 | (:global "M-=" #'count-words | ||
1981 | "C-w" #'kill-region-or-backward-word | ||
1982 | "C-c c c" #'capitalize-dwim | ||
1983 | "C-c c t" #'titlecase-dwim | ||
1984 | "C-c c u" #'upcase-dwim | ||
1985 | "C-c c l" #'downcase-dwim | ||
1986 | "C-c d" #'acdw/insert-iso-date | ||
1987 | "M-`" nil) | ||
1988 | |||
1989 | ;; toggle bindings | ||
1990 | (defvar toggle-map (make-sparse-keymap) | ||
1991 | "A keymap for toggling!") | ||
1992 | (global-set-key (kbd "C-c t") toggle-map) | ||
1993 | |||
1994 | (:with-map toggle-map | ||
1995 | (:bind "c" #'column-number-mode | ||
1996 | "l" #'display-line-numbers-mode | ||
1997 | "d" #'toggle-debug-on-error)) | ||
1998 | |||
1999 | (defalias 'forward-word-with-case 'forward-word | ||
2000 | "Alias for `forward-word' for use in `case-repeat-map'.") | ||
2001 | (defalias 'backward-word-with-case 'backward-word | ||
2002 | "Alias for `backward-word for use in `case-repeat-map'.") | ||
2003 | |||
2004 | (defvar case-repeat-map | ||
2005 | (let ((map (make-sparse-keymap))) | ||
2006 | (define-key map "c" #'capitalize-word) | ||
2007 | (define-key map "u" #'upcase-word) | ||
2008 | (define-key map "l" #'downcase-word) | ||
2009 | ;; movement | ||
2010 | (define-key map "f" #'forward-word-with-case) | ||
2011 | (define-key map "b" #'backward-word-with-case) | ||
2012 | map) | ||
2013 | "A map to repeat word-casing commands. For use with `repeat-mode'.") | ||
2014 | |||
2015 | (dolist (command '(capitalize-word | ||
2016 | capitalize-dwim | ||
2017 | upcase-word | ||
2018 | upcase-dwim | ||
2019 | downcase-word | ||
2020 | downcase-dwim | ||
2021 | forward-word-with-case | ||
2022 | backward-word-with-case)) | ||
2023 | (put command 'repeat-map 'case-repeat-map)) | ||
2024 | |||
2025 | (add-hook 'after-make-frame-functions | ||
2026 | (defun after-make-frame@maximize (frame) | ||
2027 | (unless (bound-and-true-p edit-server-frame-p) | ||
2028 | (toggle-frame-maximized frame))))) | ||
2029 | |||
2030 | (setup (:straight xr)) | 1997 | (setup (:straight xr)) |
2031 | 1998 | ||
2032 | (setup (:straight zzz-to-char) | 1999 | (setup (:straight zzz-to-char) |
diff --git a/lisp/acdw-consult.el b/lisp/acdw-consult.el index 58a2136..daad645 100644 --- a/lisp/acdw-consult.el +++ b/lisp/acdw-consult.el | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | (require 'consult) | 5 | (require 'consult) |
6 | 6 | ||
7 | ;; "Sensible" functions | ||
8 | (defun acdw-consult/sensible-grep (&optional arg) | 7 | (defun acdw-consult/sensible-grep (&optional arg) |
9 | "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep' | 8 | "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep' |
10 | if ripgrep is installed, otherwise `consult-grep'." | 9 | if ripgrep is installed, otherwise `consult-grep'." |
@@ -43,4 +42,29 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
43 | #'completion--in-region) | 42 | #'completion--in-region) |
44 | args)) | 43 | args)) |
45 | 44 | ||
45 | (defmacro consult-history-to-modes (map-hook-alist) | ||
46 | (let (defuns) | ||
47 | (dolist (map-hook map-hook-alist) | ||
48 | (let ((map-name (symbol-name (car map-hook))) | ||
49 | (key-defs `(progn (define-key | ||
50 | ,(car map-hook) | ||
51 | (kbd "M-r") | ||
52 | (function consult-history)) | ||
53 | (define-key ,(car map-hook) | ||
54 | (kbd "M-s") nil)))) | ||
55 | (push (if (cdr map-hook) | ||
56 | `(add-hook ',(cdr map-hook) | ||
57 | (defun | ||
58 | ,(intern (concat map-name | ||
59 | "@consult-history-bind")) | ||
60 | nil | ||
61 | ,(concat | ||
62 | "Bind `consult-history' to M-r in " | ||
63 | map-name ".\n" | ||
64 | "Defined by `consult-history-to-modes'.") | ||
65 | ,key-defs)) | ||
66 | key-defs) | ||
67 | defuns))) | ||
68 | `(progn ,@ (nreverse defuns)))) | ||
69 | |||
46 | (provide 'acdw-consult) | 70 | (provide 'acdw-consult) |