From 49c282f301911fd37451d34170472b63bf21650b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 12 Mar 2021 12:53:39 -0600 Subject: Add `acdw/binds' to bind more than one key at once I should probably change `acdw/bind-after-map' to use this macro... --- init.el | 8 +++++--- lisp/acdw.el | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index ee57b11..3466c12 100644 --- a/init.el +++ b/init.el @@ -151,9 +151,11 @@ (scroll-preserve-screen-position 1))) ;; Bindings -(acdw/bind "C-h" ehelp-command :after ("ehelp" nil nil 'keymap)) -(acdw/bind [remap just-one-space] cycle-spacing) -(acdw/bind "M-/" hippie-expand) +(acdw/binds (("C-h" ehelp-command :after ("ehelp" nil nil 'keymap)) + ([remap just-one-space] cycle-spacing) + ("M-/" hippie-expand) + ("M-=" count-words) + ("C-x C-b" ibuffer))) ;;; Startup (acdw/set `((inhibit-startup-screen t) diff --git a/lisp/acdw.el b/lisp/acdw.el index 3ae480d..c9a2d9f 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -205,6 +205,14 @@ The following keywords are recognized: `(progn ,@command-list))) +(defmacro acdw/binds (bindings) + "Bind multiple keys at once." + (let (bind-list) + (dolist (bind bindings) + (push `(acdw/bind ,@bind) bind-list)) + `(progn + ,@bind-list))) + ;; convenience (defmacro acdw/bind-after-map (file keymap bindings) "Wrap multiple calls of `acdw/bind' after FILE and with KEYMAP. -- cgit 1.4.1-21-gabe81