about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-09-04 23:57:04 -0500
committerCase Duckworth2021-09-04 23:57:04 -0500
commitfd3d5fc55f5e537bd4da19ada52486eb70e6bf11 (patch)
tree28ce11a7f596b88a30dc3ecbb22d9159baa25d8d /lisp
parentQuit buffers after /PART, /QUIT, /GQUIT (diff)
downloademacs-fd3d5fc55f5e537bd4da19ada52486eb70e6bf11.tar.gz
emacs-fd3d5fc55f5e537bd4da19ada52486eb70e6bf11.zip
Mostly keywording stuff
I messed up my commits here... bah
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-consult.el26
1 files changed, 25 insertions, 1 deletions
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'
10if ripgrep is installed, otherwise `consult-grep'." 9if 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)