[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map faaa33d909 77/97: Prefer eval-after-load to requi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map faaa33d909 77/97: Prefer eval-after-load to require for evil funcs |
Date: |
Thu, 20 Jan 2022 07:59:26 -0500 (EST) |
branch: elpa/bind-map
commit faaa33d90989d43da71d56fe70e1176f6b6eeff8
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Prefer eval-after-load to require for evil funcs
Requiring could screw up someone trying to sequence their load order by
loading evil unexpectedly early.
---
bind-map.el | 53 +++++++++++++++++++++++++++++------------------------
1 file changed, 29 insertions(+), 24 deletions(-)
diff --git a/bind-map.el b/bind-map.el
index 5b9908c9df..e64caeb882 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -187,8 +187,8 @@ the bindings on major and/or minor modes being active. The
options are controlled through the keyword arguments ARGS, all of
which are optional.
-The package evil is only required if one of the :evil-keys is
-specified.
+Keys for evil-mode are bound using `eval-after-load', so they
+will only take effect after evil is loaded.
:keys \(KEY1 KEY2 ...\)
@@ -270,8 +270,6 @@ mode maps. Set up by bind-map.el." map))
(append
'(progn)
- (when evil-keys '((require 'evil)))
-
`((defvar ,map (make-sparse-keymap))
(unless (keymapp ,map)
(error "bind-map: %s is not a keymap" ',map))
@@ -310,30 +308,37 @@ mode maps. Set up by bind-map.el." map))
(if (or minor-modes major-modes)
;; only bind keys in root-map
`((dolist (key (bind-map-kbd-keys (list ,@keys)))
- (define-key ,root-map key ',prefix-cmd))
- (dolist (key (bind-map-kbd-keys (list ,@evil-keys)))
- (dolist (state ',evil-states)
- (when ',major-modes
- (define-key
- (evil-get-auxiliary-keymap ,root-map state t)
- key ',prefix-cmd))
- (dolist (mode ',minor-modes)
- (when (fboundp 'evil-define-minor-mode-key)
- (evil-define-minor-mode-key
- state mode key ',prefix-cmd))))))
+ (define-key ,root-map key ',prefix-cmd)))
;; bind in global maps and possibly root-map
`((dolist (key (bind-map-kbd-keys (list ,@keys)))
(when ,override-minor-modes
(define-key ,root-map key ',prefix-cmd))
- (global-set-key key ',prefix-cmd))
- (dolist (key (bind-map-kbd-keys (list ,@evil-keys)))
- (dolist (state ',evil-states)
- (when ,override-minor-modes
- (push (list ',override-mode state key ',prefix-cmd)
- bind-map-evil-local-bindings))
- (evil-global-set-key state key ',prefix-cmd)))))
-
- (when evil-keys `((evil-normalize-keymaps))))))
+ (global-set-key key ',prefix-cmd))))
+
+ (when evil-keys
+ (if (or minor-modes major-modes)
+ `((eval-after-load 'evil
+ '(progn
+ (dolist (key (bind-map-kbd-keys (list ,@evil-keys)))
+ (dolist (state ',evil-states)
+ (when ',major-modes
+ (define-key
+ (evil-get-auxiliary-keymap ,root-map state t)
+ key ',prefix-cmd))
+ (dolist (mode ',minor-modes)
+ (when (fboundp 'evil-define-minor-mode-key)
+ (evil-define-minor-mode-key
+ state mode key ',prefix-cmd)))))
+ (evil-normalize-keymaps))))
+ `((eval-after-load 'evil
+ '(progn
+ (dolist (key (bind-map-kbd-keys (list ,@evil-keys)))
+ (dolist (state ',evil-states)
+ (when ,override-minor-modes
+ (push (list ',override-mode state key ',prefix-cmd)
+ bind-map-evil-local-bindings))
+ (evil-global-set-key state key ',prefix-cmd)))
+ (evil-normalize-keymaps)))))))))
(put 'bind-map 'lisp-indent-function 'defun)
;;;###autoload
- [nongnu] branch elpa/bind-map created (now 510a24138d), ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6e19e536fc 03/97: Add link to evil-leader, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map f2f7dfefbd 07/97: Assume :keys and :evil-keys are lists, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 3a2f1d8074 01/97: Initial commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 115e0459bf 05/97: Bring back set-keys function, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map d7aee3c6ab 09/97: Note helper funcs in README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map a8a2937ecc 38/97: Minor tweak to previous commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map faaa33d909 77/97: Prefer eval-after-load to require for evil funcs,
ELPA Syncer <=
- [nongnu] elpa/bind-map 61fe55e097 17/97: Can't simply use cl-pushnew, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 5508980148 69/97: Account for multiple declarations of the same map, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b05ea98102 37/97: Add option to use local state maps, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 7d20946692 04/97: Add autoloads, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 7de08fe592 43/97: Move a defvar and reword docstring, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map bb7a8b2258 59/97: Remove declare-function from previous commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6d05297e3c 20/97: Add another example and more detail to README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map d47be94d23 63/97: Don't try to bind keys that are nil or "", ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ebc4c9fb11 34/97: Remove bind-map-kbd hack, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 8ec4516db2 48/97: Remove use of evil-define-key, ELPA Syncer, 2022/01/20