Change acdw/bind-after-map thinking

This commit is contained in:
Case Duckworth 2021-02-27 08:16:12 -06:00
parent e689cd8c92
commit e6e6c6aa91
1 changed files with 16 additions and 37 deletions

View File

@ -790,7 +790,7 @@ to /hide/ those contents.
#+end_src
#+begin_src emacs-lisp :noweb-ref bindings
(acdw/bind-after-map 'icomplete icomplete-minibuffer-map
(acdw/bind-after-map icomplete icomplete-minibuffer-map
(("<down>" #'icomplete-forward-completions)
("C-n" #'icomplete-forward-completions)
("<up>" #'icomplete-backward-completions)
@ -821,39 +821,11 @@ to /hide/ those contents.
*** Consult :package:
#+begin_src emacs-lisp :noweb-ref modes
(straight-use-package 'consult)
(dolist (f '(consult-history
consult-mode-command
consult-complex-command
consult-buffer
consult-buffer-other-window
consult-buffer-other-frame
consult-register
consult-bookmark
consult-line
consult-outline
consult-mark
consult-global-mark
consult-imenu
consult-error
consult-grep
consult-find
consult-line
consult-multi-occur
consult-keep-lines
consult-focus-lines
consult-yank-pop
consult-apropos))
(unless (fboundp f)
(autoload (function f) "consult")))
#+end_src
Consult has a lot of great bindings that work well with Emacs's
default completion system. These all come from the [[https://github.com/minad/consult#configuration][example configuration]].
#+begin_src emacs-lisp :noweb-ref bindings
(acdw/bind-after-map 'consult acdw/map
(acdw/bind-after-map consult nil
;; C-c bindings (`mode-specific-map')
(("C-c h" #'consult-history)
("C-c m" #'consult-mode-command)
@ -994,12 +966,19 @@ little sugar on top of =define-key= et al.
FEATURE is the argument to `with-eval-after-load'. KEYMAP is
passed to the `:map' argument of `acdw/bind', if it's non-nil."
(declare (indent 2))
(let (bind-list)
(let ((bind-list)
(name-string (if (stringp feature) feature
(symbol-name feature))))
(dolist (bind bindings bind-list)
(if keymap
(push `(acdw/bind ,@bind :map ,keymap) bind-list)
(push `(acdw/bind ,@bind) bind-list)))
`(with-eval-after-load ,feature
(push `(progn (unless (fboundp ,(cadr bind))
(autoload ,(cadr bind)
,name-string nil t))
(acdw/bind ,@bind
:map
,(if keymap keymap
'acdw/map)))
bind-list))
`(with-eval-after-load ',feature
,@bind-list)))
#+end_src
@ -1720,7 +1699,7 @@ I've switched =query-replace= and =query-replace-regexp= with their anzu
versions, because of the regex thing.
#+begin_src emacs-lisp :noweb-ref bindings
(acdw/bind-after-map 'anzu nil
(acdw/bind-after-map anzu nil
(([remap query-replace] #'anzu-query-replace-regexp)
([remap query-replace-regexp] #'anzu-query-replace)
([remap isearch-query-replace] #'anzu-isearch-query-replace
@ -2441,7 +2420,7 @@ others.
#+end_src
#+begin_src emacs-lisp :noweb-ref bindings
(acdw/bind-after-map 'elpher elpher-mode-map
(acdw/bind-after-map elpher elpher-mode-map
(("n" #'elpher-next-link)
("p" #'elpher-prev-link)
("o" #'elpher-follow-current-link)