GNU bug report logs -
#79305
31.0.50; MODE-set-explicitly change caused regressions in bind-map
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Wed, Sep 03, 2025 at 8:07 PM, Stefan Monnier < monnier <at> iro.umontreal.ca > wrote:
>
>
>>
>>
>> You can try it interactively, but the steps are a little different. If you
>> comment everything below the scenario 1 hooks and then run:
>>
>>
>>
>>
>> emacs -Q -l scripts/repro-evil-local-override-race.el
>>
>>
>>
>>
>> Then M-x evil-mode
>>
>>
>>
>>
>> Then C-x C-f somefile
>>
>>
>>
>>
>> Then SPC x
>>
>>
>>
>>
>> It will not invoke the binding.
>>
>>
>>
>>
>> If you then comment the Scenario 1 hooks and comment the Scenario 2 hooks
>> and try the same thing, SPC x will be bound.
>>
>>
>>
>
>
>
> I don't understand enough of what these things mean to know what is
> supposed to be the right behavior (and why).
>
>
>
>
> Is this `SPC x` key supposed to be bound if and only if the
> `repro-override-mode` is enabled?
>
>
>
Yes. This is how bind-map works. It adds to `evil-normal-state-local-map`, which is a buffer local key map. It does this in response to evil-local-mode-hook, which, when evil-mode is enabled, will trigger in most buffers, and when it does, if the globalized minor mode being considered has not yet been initialized (as you mention below) then it cannot simply use the mode variable to determine if it's enabled. That's the inherent ordering problem. There are effectively two globalized minor modes that are order dependent. The work around present in bind-map (and eliminated in your proposed patch to bind-map) is to check to see if the globalized minor mode *will* be enabled eventually by using the same criteria used to enable it later.
To be clear, I think this is a flaw in bind-map. I shared the repro before I figured out an alternative that does not have this limitation and is more in line with how evil seems to work. In other words, you may feel free to disregard this repro and proceed with closing this bug if you like. I don't know if bind-map will be updated or not, but it does seem like it's not essential for it to use to the set-explicitly internal variable.
Aaron
[Message part 2 (text/html, inline)]
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.