[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map 5c6f17939c 28/97: Get rid of eval-after-loads to
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map 5c6f17939c 28/97: Get rid of eval-after-loads to fix evil bindings |
Date: |
Thu, 20 Jan 2022 07:59:12 -0500 (EST) |
branch: elpa/bind-map
commit 5c6f17939c44416ebc2615d02dacd9e56c3d6548
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Get rid of eval-after-loads to fix evil bindings
They were only working by accident when evil was already loaded. Will
try to fix in the future
---
bind-map.el | 60 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/bind-map.el b/bind-map.el
index c53d4bb8cf..cf651962ac 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -136,7 +136,8 @@ Declare a prefix command for MAP named COMMAND-NAME."
(major-mode-list (intern (format "%s-major-modes" map)))
(activate (intern (format "%s-activate" map)))
(activate-func (intern (format "%s-activate-function" map)))
- (prefix-cmd (plist-get args :prefix-cmd))
+ (prefix-cmd (or (plist-get args :prefix-cmd)
+ (intern (format "%s-cmds" map))))
(keys (mapcar 'bind-map-kbd (plist-get args :keys)))
(evil-keys (mapcar 'bind-map-kbd (plist-get args :evil-keys)))
(evil-states (or (plist-get args :evil-states)
@@ -146,9 +147,8 @@ Declare a prefix command for MAP named COMMAND-NAME."
`(progn
(defvar ,map (make-sparse-keymap))
- (when ',prefix-cmd
- (setq ,prefix-cmd ,map)
- (setf (symbol-function ',prefix-cmd) ,map))
+ (setq ,prefix-cmd ,map)
+ (setf (symbol-function ',prefix-cmd) ,map)
(when ',minor-modes
(defvar ,root-map-sym (make-sparse-keymap))
@@ -163,21 +163,20 @@ Declare a prefix command for MAP named COMMAND-NAME."
(setq ,major-mode-list (append ,major-mode-list ',major-modes))
(defun ,activate-func ()
(setq ,activate (not (null (member major-mode ,major-mode-list)))))
- (add-hook 'after-change-major-mode-hook ',activate-func))
-
- (let ((prefix (or ',prefix-cmd ,map)))
- (if (or ',minor-modes ',major-modes)
- ;;bind keys in root-map
- (progn
- (dolist (key ',keys)
- (define-key ,root-map-sym key prefix))
- (bind-map-evil-define-key
- ',evil-states '(,root-map-sym) ',evil-keys (quote prefix)))
- ;;bind in global maps
- (dolist (key ',keys)
- (global-set-key key prefix))
- (bind-map-evil-define-key
- ',evil-states nil ',evil-keys (quote prefix)))))))
+ (add-hook 'change-major-mode-after-body-hook ',activate-func))
+
+ (if (or ',minor-modes ',major-modes)
+ ;;bind keys in root-map
+ (progn
+ (dolist (key ',keys)
+ (define-key ,root-map-sym key ',prefix-cmd))
+ (bind-map-evil-define-key
+ ',evil-states ,root-map-sym ',evil-keys ',prefix-cmd))
+ ;;bind in global maps
+ (dolist (key ',keys)
+ (global-set-key key ',prefix-cmd))
+ (bind-map-evil-define-key
+ ',evil-states nil ',evil-keys ',prefix-cmd)))))
(put 'bind-map 'lisp-indent-function 'defun)
;;;###autoload
@@ -224,20 +223,21 @@ minor mode with -bm-map appended."
',map-name)))
(put 'bind-map-for-minor-mode 'lisp-indent-function 'defun)
-(defun bind-map-evil-define-key (states maps keys def)
- "Version of `evil-define-key' that binds DEF across multiple STATES,
-MAPS, and KEYS."
- (eval-after-load 'evil
- `(progn
- (dolist (state ',states)
- (dolist (key ',keys)
- (if ',maps
- (dolist (map (list ,@maps))
- (evil-define-key state map key ,def))
- (evil-global-set-key state key ,def)))))))
(defun bind-map-kbd (key)
(if (stringp key) (kbd key) (kbd (eval key))))
+(defun bind-map-evil-define-key (states map keys def)
+ "Version of `evil-define-key' that binds DEF across multiple
+STATES and KEYS."
+ (when keys
+ (require 'evil)
+ (dolist (state states)
+ (dolist (key keys)
+ (if map
+ (eval
+ `(evil-define-key ',state ',map ,key ',def))
+ (eval
+ `(evil-global-set-key ',state ,key ',def)))))))
;;;###autoload
(defun bind-map-set-keys (map key def &rest bindings)
- [nongnu] elpa/bind-map 7ab7ae8dd3 62/97: Fix cask file, (continued)
- [nongnu] elpa/bind-map 7ab7ae8dd3 62/97: Fix cask file, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 8e3df1f4cf 36/97: Use add-to-list for mm list and defvar prefix, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ce11d259bf 42/97: Update commentary to match README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 32a3361b3b 67/97: Bring back evil-define-minor-mode-key, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 56e4a914c2 82/97: Fix tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 797c2124f8 86/97: Restructure tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6e1ba6edbd 94/97: Update README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 873c26d467 89/97: Get basic inheritance tests working, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6977e0fec5 96/97: Bump version to 1.1.2, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b59d7bbab7 40/97: Add note about dependence on evil to README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 5c6f17939c 28/97: Get rid of eval-after-loads to fix evil bindings,
ELPA Syncer <=
- [nongnu] elpa/bind-map 80c38c4052 61/97: Add badges, ELPA Syncer, 2022/01/20
- [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