Repository navigation
Fix stale [Compiling] modeline and copy-mode trap in ghostel-compile - #607
Merged
Merged
Conversation
dakra
force-pushed
the
fix/compile-kill-and-copy-mode
branch
from
August 6, 2026 16:28
be69e25 to
f0a7cb1
Compare
Killing a compile buffer kills its process and fires the sentinel with a dead buffer, which skipped the compilation-in-progress cleanup and left the global [Compiling] mode-line indicator stuck forever. Run the cleanup in an unwind-protect cleanup form, mirroring stock compilation-sentinel (which also orders it after the finalize, so finish hooks observe stock-compatible state).
A compilation-style compile buffer is a log, not a terminal input surface, but the point-leave check (minibuffer exit, isearch end) and mark activation still auto-entered copy mode there: point sits away from the VT cursor by design, so e.g. popper selecting the freshly created popup froze the terminal in copy mode before any output rendered. Gate both switches on ghostel--inhibit-insert-forwarding, the existing compilation-style marker. Interactive compile runs keep the flag nil, so auto-switching still works where the buffer behaves like a real terminal.
Exiting a read-only mode always restored a terminal input mode and its keymap; in a compilation-style compile buffer that clobbered ghostel-compile-view-mode-map with ghostel-semi-char-mode-map, so navigation keys were sent to the PTY until finalize. Add ghostel--readonly-exit-function: when non-nil, ghostel-readonly-exit delegates the entire post-exit restore to it, and the *-and-send exits skip forwarding the triggering key. Compile buffers install ghostel-compile--restore-compilation-style, which reinstates the view keymap, the read-only barrier, and the :run indicator, and restarts the frozen redraw timer. The function is set and cleared in lockstep with the insert-forwarding inhibit flag through a shared setter.
dakra
force-pushed
the
fix/compile-kill-and-copy-mode
branch
from
August 6, 2026 16:45
f0a7cb1 to
ddee01b
Compare
|
I forgot to mention, my emacs version is 32.0.50 |
This branch was previously deployed
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.
Fixes #605.
Two bugs in compilation-style
ghostel-compilebuffers:[Compiling]modeline: killing a compile buffer mid-run fired the sentinel with a dead buffer, which skipped thecompilation-in-progresscleanup — the dead process stayed in the list and the global[Compiling]indicator stuck forever.M-x ghostel-compileminibuffer exit fired in the popper-selected popup window and auto-entered copy mode (frozen terminal, no output). Exiting copy mode then restoredghostel-semi-char-mode-map, clobberingghostel-compile-view-mode-mapsoC-p/C-n/RETwere sent to the PTY until finalize.One commit per fix:
compilation-in-progresswhen the compile buffer dies mid-run: the sentinel now runs the cleanup in anunwind-protectcleanup form, mirroring stockcompilation-sentinel(including its ordering: finalize before thedelq, so finish hooks observe stock-compatible state).ghostel--inhibit-insert-forwarding, the existing compilation-style marker. Interactive compile runs (flag nil) keep auto-switching.ghostel--readonly-exit-function; when set,ghostel-readonly-exitdelegates the post-exit restore to it and the*-and-sendexits don't forward the triggering key. Compile buffers installghostel-compile--restore-compilation-style(view keymap, read-only barrier,:runindicator, redraw-timer restart), set/cleared in lockstep with the inhibit flag through a shared setter. This also covers the remaining paths into copy mode there (explicitM-x ghostel-copy-mode, link follow).Tests: 8 new (6 elisp, 2 native), including an end-to-end kill-mid-run test and an integration test that goes through
ghostel-compile--start→ghostel-copy-mode→ exit against the production wiring.Verified live (Emacs 31, real popper 0.4.8): kill mid-run leaves no
[Compiling]; with popper the compile popup opens in semi-char with output streaming and view keys bound; copy-mode exit restores the view state with no byte sent to the PTY.