Honor C-g in ghostel-keymap-exceptions#491
Merged
Merged
Conversation
C-g was hardcoded in the base map ghostel-mode-map, so it bypassed the keymap-exceptions filter that every other key goes through: adding "C-g" to ghostel-keymap-exceptions had no effect and C-g was always sent to the terminal. Bind C-g in ghostel--rebuild-semi-char-keymap instead, driven by the exception list: ghostel-send-C-g when not excepted, left unbound (so it falls through to the user's global binding, e.g. keyboard-quit) when excepted. Char mode and read-only fast-exit keep their own C-g bindings and are unaffected. Fixes #489.
dakra
force-pushed
the
fix/489-keymap-exceptions-c-g
branch
from
June 30, 2026 21:46
3ad8dea to
4ceef34
Compare
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 #489.
Problem
Adding
"C-g"toghostel-keymap-exceptionshad no effect — C-g was still sent to the terminal. Every other exception key is bound throughghostel--define-terminal-keysand simply omitted when listed, but C-g was hardcoded in the static base mapghostel-mode-map, which every input mode inherits and which the exception filter never touches.Fix
Bind C-g in
ghostel--rebuild-semi-char-keymapinstead (the function that runs at load and on everysetopt/customize), driven by the exception list:ghostel-send-C-g(sends BEL, as before)keyboard-quit, but whatever they've bound — no command hardcoded)ghostel-send-C-gitself is untouched. Char mode and read-only fast-exit keep their own explicit C-g bindings and are intentionally unaffected (char mode forwards everything to the TUI app; fast-exit C-g exits the mode).Verification
make allgreen; new ERT testghostel-test-c-g-exception-unbinds.*ghostel*buffers across semi-char, char, line, copy, Emacs (fast-exit on/off), and evil-ghostel (insert/normal/visual), in both directions (active by default; falls through tokeyboard-quitwhen excepted ornil-bound).inhibit-quit/quit-flaginteraction is clean: the fall-throughkeyboard-quitlands,quit-flagclears, no stray pending quit, no wedge.