Fixes for evil-want-minibuffer#2008
Open
real-or-random wants to merge 2 commits intoemacs-evil:masterfrom
Open
Fixes for evil-want-minibuffer#2008real-or-random wants to merge 2 commits intoemacs-evil:masterfrom
real-or-random wants to merge 2 commits intoemacs-evil:masterfrom
Conversation
This avoids the advice on select-window which is not removed even after disabling Evil and which is not called when select-window is called internally from C code, e.g., in read-from-minibuffer.
evil-initialize will be called earlier anyway, namely via after-change-major-mode-hook when the major mode in the minibuffer changes to minibuffer-mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two issues with
evil-want-minibufferset tot:The cursor is not refreshed after initializing evil in the minibuffer
This can be observed when the initial state in the minibuffer (defaults to insert state in the minibuffer) has a different cursor color than the cursor that was active previously. I don't observe the effect of this bug in every use of the minibuffer (because sometimes a refresh will be triggered by other events), but ironically, I observe it in evil-ex.
I tracked this down to the following series of events:
evil-excallsread-from-minibufferread-from-minibuffercreates a fresh buffer (to become the minibuffer) and changes its major mode tominibuffer-modeafter-change-major-mode-hookwhich callsevil-initializeevil-initializedoes not abort even though(minibufferp)becauseevil-want-minibufferis set, and so it callsevil-local-modeevil-local-modeskipsevil-refresh-cursorbecause the currently selected window does not (yet) display the minibuffer. More precisely,(when (eq (window-buffer) (current-buffer))isnil. (This check has been added in Fix cursor colour #1910, and it's correct.)read-from-minibuffermakes the minibuffer window the selected window. But because everything happens in C, this bypasses our advice forselect-windowthat is supposed to refresh the cursor.evil-initializewill be called again fromminibuffer-setup-hooksbutevil-change-statewill correctly determine that we're already in the right state and skip further processing, including a potential cursor refresh.)The first commit fixes this, at least in Emacs >= 27, by using the new
window-*-change-functionhooks instead of advice. This also makes it possible to handle the cursor refresh inevil-local-mode, which will disable it correctly when disabling evil. The latter fixes aFIXME.evil-initializeis called twice in minibufferSee item 7 above. This is fixed by the second commit. Afterward, the minibuffer will be treated like every other buffer for evil purposes (if
evil-want-minibufferis set).