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

From: "Aaron Jensen" <[email-masked]>
Date: Sun, 31 Aug 2025 18:21:50 +0000

Hi Sean,

I believe it's using it only to determine whether or not to apply a key map to a minor mode. Specifically, it's attempting to detect the state when the global minor mode is enabled but that it is disabled explicitly in the given buffer. I have no idea why it doesn't just look at the value of the mode variable, which, as far as I understand it, would be made buffer local and nil in that same case. There must be some circumstance where that variable will not yet be set or buffer local and would have led to false indications.

Without the original author or specific tests for that scenario, I couldn't say anything for sure. I'd be fine with your proposal to restore the variable and mark it obsolete. I'm not sure that the original author of bind-map is very active anymore. I can update this bug if I hear anything from bind-map folks.

Thanks,

Aaron

On Sun, Aug 31, 2025 at 8:23 AM, Sean Whitton < [email-masked] > wrote:

> 
> 
> 
> Hello,
> 
> 
> 
> On Fri 29 Aug 2025 at 04:23pm GMT, Aaron Jensen wrote:
> 
> 
>> 
>> 
>> On Fri, Aug 29 , 2025 at 7:43 AM, Stefan Monnier < monnier@ iro. umontreal.
>> ca ( [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
>> (
>> 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
> 
> 
>