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

From: "Aaron Jensen" <[email-masked]>
Date: Mon, 01 Sep 2025 16:31:13 +0000

It's my understanding that the check for set-explicitly is done because given where this hook runs, it's possible that the mode variable is not yet initialized, which means that even though it eventually will be, and thus could be relied on, it may not be. Therefore, bind-map relies on similar logic as the minor mode itself to determine whether or not the minor mode *will eventually* be enabled. It seems like your proposed patch to bind-map would be subject to this "hook race".

Again, this is just an informed guess as I haven't set up the conditions to reproduce it yet.

I have extracted the relevant bind-map code to my own library that depended on it:

https://github.com/aaronjensen/emacs-leader-key/blob/master/leader-key.el#L109

Currently, it still relies on set-explicitly (accepting both forms), but if there's a way that we can get it to not I'd be happy to try it out.

Aaron

On Mon, Sep 01, 2025 at 8:42 AM, Stefan Monnier < [email-masked] > wrote:

> 
> 
>> 
>>> 
>>> 
>>> 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).
>>> 
>>> 
>> 
>> 
>> 
>> You don't think we should even restore it and mark it as obsolete?
>> 
>> 
> 
> 
> 
> Since I believe bind-map's code was only half-working to begin with: no, I
> don't think it's worth the trouble. It would just help them muddle
> through. I'd rather help them fix their code for good.
> 
> 
> 
> Stefan
> 
> 
>