Skip to content

Skip evil-escape's speculative first-key insert in ghostel buffers - #598

Merged
dakra merged 1 commit into
mainfrom
fix/evil-escape-speculative-insert
Aug 4, 2026
Merged

dakra merged 1 commit into
mainfrom
fix/evil-escape-speculative-insert

Conversation

@dakra

@dakra dakra commented Aug 4, 2026

Copy link
Copy Markdown
Owner

evil-escape previews the first key of its chord (e.g. jk) with a speculative self-insert-command it reverts moments later, guarded by buffer-read-only. Since live terminal buffers became writable for the foreign-edit interceptor (0.47.0), that preview was captured and forwarded to the PTY where it cannot be reverted: a lone first key reached the shell twice (jj), and a completed chord leaked it once before entering normal state.

evil-ghostel now gates evil-escape--insert with :before-while advice returning nil in ghostel buffers, so the preview is skipped and the chord works through read-event alone, exactly as it did while the buffer was read-only. The advice is installed at top level; nadvice keeps it pending until evil-escape defines the function, covering either load order. Users without evil-escape are unaffected (the advice stays inert on the undefined symbol).

Verified end-to-end in live sandboxed Emacs sessions (evil + evil-escape "jk" + evil-ghostel, raw TTY key injection through the real command loop), in both load orders: a lone j is sent to the PTY exactly once and stays in insert state; jk sends nothing, enters normal state, and leaves the prompt line clean. Includes a regression test covering the advice gating.

Fixes #597

evil-escape previews the first key of its chord (e.g. jk) with a
speculative self-insert-command it reverts moments later, guarded by
buffer-read-only.  Since live terminal buffers became writable for the
foreign-edit interceptor, that preview was captured and forwarded to
the PTY where it cannot be reverted: a lone first key reached the
shell twice, and a completed chord leaked it once before entering
normal state.

evil-ghostel now gates evil-escape--insert with :before-while advice
returning nil in ghostel buffers, so the preview is skipped and the
chord works through read-event alone, as it did while the buffer was
read-only.  The advice is installed at top level; nadvice keeps it
pending until evil-escape defines the function, covering either load
order.

Fixes #597
@dakra
dakra merged commit 910e05e into main Aug 4, 2026
29 checks passed
@dakra
dakra deleted the fix/evil-escape-speculative-insert branch August 4, 2026 19:23

This branch was previously deployed

1 inactive deployment
github-pages — 910e05e1 Deployed Aug 4, 2026 by dakra via deploy #144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

recent updates breaks evil-escape

1 participant