From e6e6c6aa91f16e5d66ce3df03ad19b7bfa20de27 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 27 Feb 2021 08:16:12 -0600 Subject: Change acdw/bind-after-map thinking --- config.org | 53 ++++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/config.org b/config.org index 5221a70..c4af8b0 100644 --- a/config.org +++ b/config.org @@ -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 (("" #'icomplete-forward-completions) ("C-n" #'icomplete-forward-completions) ("" #'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) -- cgit 1.4.1-21-gabe81