Subject: bug#79305: 31.0.50; MODE-set-explicitly change caused regressions in bind-map

From: Sean Whitton <[email-masked]>
Date: Sun, 31 Aug 2025 16:23:12 +0100

Hello,

On Fri 29 Aug 2025 at 04:23pm GMT, Aaron Jensen wrote:

> On Fri, Aug 29, 2025 at 7:43 AM, Stefan Monnier <[email-masked]>
> wrote:
>
>  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?
>
> It was in a commit with this message:
>
> 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).
>
> https://github.com/justbur/emacs-bind-map/commit/89747f7240e5f51084fd94aad502d67f426e03b4

Thanks for the link.  Unfortunately it seems like it would take a lot of
evil-mode knowledge to really know what's going on there.

Let me ask about the original purpose of the -set-explicitly machinery.
The comments say that the idea is that if the major mode hook has
(global-foo-mode -1), then our hook in after-change-major-mode-hook
won't undo that.

Major mode hooks are generally for the user.  So the idea is that this
is primarily a way for the user to disable the global minor mode in
particular major modes.  Right?

It looks to me that what emacs-bind-map is trying to use -set-explicitly
for is not that, but something about hook ordering.  So it's using it
for some other purpose, so it is probably using the wrong mechanism.

I think therefore in the absence of more information on the evil-mode
stuff, we should go ahead with restoring the variable but marking it as
obsolete.

-- 
Sean Whitton