On Wed, Sep 03, 2025 at 3:43 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

;; Common sequence for both tests (identical order):
;; - New buffer
;; - Do NOT touch the per-buffer mode var (it is naturally nil here)
;; - Enable Evil locally (hook fires while per-buffer mode is still nil)

;; Scenario 1: Broken path misses install due to requiring buffer-local mode
(remove-hook 'evil-local-mode-hook #'repro-broken-install)
(remove-hook 'evil-local-mode-hook #'repro-fixed-install)
(add-hook 'evil-local-mode-hook #'repro-broken-install)

(with-temp-buffer
(evil-local-mode 1)
(repro-log "BROKEN installed? %S" (repro-installed-p)))

I don't understand the intention behind this test: a temp buffer is not expected to be exposed to the user, so the specific way `evil-mode` behaves in it doesn't seem very relevant.


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.

Also, the `repro-override-mode` is not enabled in that buffer, so IIUC the `repro-key` binding should not be active, so it would be a bug if

(repro-installed-p) to returned non-nil, right?


It's globalized and is enabled via:

(global-repro-override-mode 1)

Globalized minor modes are the problematic thing here.

Aaron