[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map af26966c9a 57/97: Make macro expansion prettier
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map af26966c9a 57/97: Make macro expansion prettier |
Date: |
Thu, 20 Jan 2022 07:59:21 -0500 (EST) |
branch: elpa/bind-map
commit af26966c9a32bdfc71bbe388bba27fde144bda4b
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Make macro expansion prettier
---
bind-map.el | 61 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/bind-map.el b/bind-map.el
index 5ffbcd2119..4ee34ce0c8 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -242,33 +242,35 @@ mode maps. Set up by bind-map.el." map))
bind-map-default-evil-states))
(minor-modes (plist-get args :minor-modes))
(major-modes (plist-get args :major-modes)))
- `(progn
- (when ',evil-keys (require 'evil))
+ (append
+ '(progn)
+
+ (when evil-keys '((require 'evil)))
- (defvar ,map (make-sparse-keymap))
+ `((defvar ,map (make-sparse-keymap))
(unless (keymapp ,map)
(error "bind-map: %s is not a keymap" ',map))
(defvar ,prefix-cmd nil)
(setq ,prefix-cmd ,map)
(setf (symbol-function ',prefix-cmd) ,map)
- (defvar ,root-map (make-sparse-keymap))
+ (defvar ,root-map (make-sparse-keymap)))
- (when ',minor-modes
- (dolist (mode ',minor-modes)
- (push (cons mode ,root-map) minor-mode-map-alist)))
+ (when minor-modes
+ `((dolist (mode ',minor-modes)
+ (push (cons mode ,root-map) minor-mode-map-alist))))
- (when ',major-modes
- ;; compiler warns about making a local var below the top-level
- (with-no-warnings (defvar-local ,active-var nil))
+ (when major-modes
+ ;; compiler warns about making a local var below the top-level
+ `((with-no-warnings (defvar-local ,active-var nil))
(push (cons ',active-var ,root-map) minor-mode-map-alist)
(push (cons ',active-var ',major-modes) bind-map-major-modes-alist)
;; call once in case we are already in the relevant major mode
- (bind-map-change-major-mode-after-body-hook))
+ (bind-map-change-major-mode-after-body-hook)))
- (when (and ,override-minor-modes
- (null ',major-modes)
- (null ',minor-modes))
- (defun ,turn-on-override-mode ()
+ (when (and override-minor-modes
+ (null major-modes)
+ (null minor-modes))
+ `((defun ,turn-on-override-mode ()
,turn-on-override-mode-doc
(unless (minibufferp) (,override-mode 1)))
;; for make-local warnings
@@ -279,19 +281,18 @@ mode maps. Set up by bind-map.el." map))
,override-mode-doc))
(add-to-list 'emulation-mode-map-alists
(list (cons ',override-mode ,root-map)))
- (,global-override-mode 1))
-
- (if (or ',minor-modes ',major-modes)
- ;;bind keys in root-map
- (progn
- (dolist (key (list ,@keys))
- (define-key ,root-map (kbd key) ',prefix-cmd))
- (dolist (key (list ,@evil-keys))
- (dolist (state ',evil-states)
- (define-key (evil-get-auxiliary-keymap ,root-map state t)
- (kbd key) ',prefix-cmd))))
- ;;bind in global maps
- (dolist (key (list ,@keys))
+ (,global-override-mode 1)))
+
+ (if (or minor-modes major-modes)
+ ;; only bind keys in root-map
+ `((dolist (key (list ,@keys))
+ (define-key ,root-map (kbd key) ',prefix-cmd))
+ (dolist (key (list ,@evil-keys))
+ (dolist (state ',evil-states)
+ (define-key (evil-get-auxiliary-keymap ,root-map state t)
+ (kbd key) ',prefix-cmd))))
+ ;; bind in global maps and possibly root-map
+ `((dolist (key (list ,@keys))
(when ,override-minor-modes
(define-key ,root-map (kbd key) ',prefix-cmd))
(global-set-key (kbd key) ',prefix-cmd))
@@ -300,9 +301,9 @@ mode maps. Set up by bind-map.el." map))
(when ,override-minor-modes
(push (list ',override-mode state (kbd key) ',prefix-cmd)
bind-map-evil-local-bindings))
- (evil-global-set-key state (kbd key) ',prefix-cmd))))
+ (evil-global-set-key state (kbd key) ',prefix-cmd)))))
- (when ',evil-keys (evil-normalize-keymaps)))))
+ (when evil-keys `((evil-normalize-keymaps))))))
(put 'bind-map 'lisp-indent-function 'defun)
;;;###autoload
- [nongnu] elpa/bind-map 4cccf8fb82 23/97: Add configuration var for default map suffix, (continued)
- [nongnu] elpa/bind-map 4cccf8fb82 23/97: Add configuration var for default map suffix, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 7a4d329a60 18/97: Correct wrong package names, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 4cf9dfd1cb 81/97: Fix declare form, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ddce68ed1d 53/97: Move evil-local-mode hook next to var, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 2a5fcbd947 73/97: Revert "Fix incorrect check of override mode in local hook", ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map f4fad049d0 70/97: Bump to version 1.0, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9599acb5ab 35/97: Silence warning about defvar-local, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 662dea907c 51/97: Suppress make-local warnings from compiler, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9a676378fe 54/97: Simplify major-mode activation, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map e239bbdaef 44/97: Always use global evil maps, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map af26966c9a 57/97: Make macro expansion prettier,
ELPA Syncer <=
- [nongnu] elpa/bind-map 393879d260 58/97: Satisfy compiler, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 2fafc10f7d 45/97: Rename a var and a function and tweak a docstring, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map e94572b50b 74/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 00b7778826 68/97: Fix minor-mode tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9ae3e9b113 72/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 40ed95d4d5 80/97: Add bindings keyword, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6f84c0254f 78/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map c335674139 60/97: Add files for travis, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 89747f7240 75/97: Fix evil-local-mode-hook logic, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 76b8e2ab6c 85/97: Add tests for inheritance, ELPA Syncer, 2022/01/20