emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/bind-map 89747f7240 75/97: Fix evil-local-mode-hook logic


From: ELPA Syncer
Subject: [nongnu] elpa/bind-map 89747f7240 75/97: Fix evil-local-mode-hook logic
Date: Thu, 20 Jan 2022 07:59:26 -0500 (EST)

branch: elpa/bind-map
commit 89747f7240e5f51084fd94aad502d67f426e03b4
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>

    Fix evil-local-mode-hook logic
    
    Can't be sure that the override modes are enabled before this hook is
    run so we check if the global mode is enabled and if the local mode is
    set explicitly in a prior hook (presumably a major mode hook).
---
 bind-map.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/bind-map.el b/bind-map.el
index 4d40d0c962..8d64d7028f 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -129,10 +129,16 @@ be activated.")
   "Called to activate local state maps in a buffer."
   ;; format is (OVERRIDE-MODE STATE KEY DEF)
   (dolist (entry bind-map-evil-local-bindings)
-    (let ((map (intern (format "evil-%s-state-local-map" (nth 1 entry)))))
-      (when (and (nth 0 entry)
-                 (boundp map)
-                 (keymapp (symbol-value map)))
+    (let* ((map (intern (format "evil-%s-state-local-map" (nth 1 entry))))
+           (mode (nth 0 entry))
+           (global-mode (intern (format "global-%s" (nth 0 entry))))
+           (set-explicitly (intern (format "%s-set-explicitly" mode))))
+      (when (and (boundp global-mode) (boundp mode)
+                 (boundp set-explicitly) (boundp map)
+                 (keymapp (symbol-value map))
+                 (symbol-value global-mode)
+                 (not (and (symbol-value set-explicitly)
+                           (null (symbol-value mode)))))
         (define-key (symbol-value map) (nth 2 entry) (nth 3 entry))))))
 (add-hook 'evil-local-mode-hook 'bind-map-evil-local-mode-hook)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]