GNU bug report logs - #79305
31.0.50; MODE-set-explicitly change caused regressions in bind-map

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Sun, 24 Aug 2025 22:19:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: Jonas Bernoulli <jonas <at> bernoul.li>, 79305 <at> debbugs.gnu.org, Aaron Jensen <aaronjensen <at> gmail.com>, Justin Burkett <justin <at> burkett.cc>
Subject: bug#79305: 31.0.50; MODE-set-explicitly change caused regressions in bind-map
Date: Mon, 01 Sep 2025 00:49:48 -0400
>> bind-map shouldn't use an internal variable like that.
> +1, tho maybe bind-map has a good reason to do that.
> Does anyone know something about that?

After spending some time looking at the code, its history, and the
corresponding doc, my conclusion is that `bind-map`s code was probably
incorrect already with older Emacsen (just in different ways) and its
intended behavior is far from clear, so I think it's best to leave this
as a WONTFIX and let `bind-map`s authors figure out what to do on
their side (tho I'd be happy to help them figure that out).

The best patch I could come up with is the one below.


        Stefan


diff --git a/bind-map.el b/bind-map.el
index 41e6e5b5f0..204748efe8 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -171,19 +171,17 @@ be activated.")
          (when properties (pop properties)))))
 
 (defun bind-map-evil-local-mode-hook ()
-  "Called to activate local state maps in a buffer."
+  "Activate local state maps in a buffer." ;; FIXME: Which 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))))
            (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)
+           ;; FIXME: Why do we care about an associated global mode?
+           (global-mode (intern (format "global-%s" mode))))
+      (when (and (boundp global-mode) (boundp mode) (boundp map)
                  (keymapp (symbol-value map))
                  (symbol-value global-mode)
-                 (not (and (symbol-value set-explicitly)
-                           (null (symbol-value mode)))))
+                 (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)
 





This bug report was last modified 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.