Skip to content

Honor C-g in ghostel-keymap-exceptions#491

Merged
dakra merged 1 commit into
mainfrom
fix/489-keymap-exceptions-c-g
Jun 30, 2026
Merged

Honor C-g in ghostel-keymap-exceptions#491
dakra merged 1 commit into
mainfrom
fix/489-keymap-exceptions-c-g

Conversation

@dakra

@dakra dakra commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Fixes #489.

Problem

Adding "C-g" to ghostel-keymap-exceptions had no effect — C-g was still sent to the terminal. Every other exception key is bound through ghostel--define-terminal-keys and simply omitted when listed, but C-g was hardcoded in the static base map ghostel-mode-map, which every input mode inherits and which the exception filter never touches.

Fix

Bind C-g in ghostel--rebuild-semi-char-keymap instead (the function that runs at load and on every setopt/customize), driven by the exception list:

  • not excepted → ghostel-send-C-g (sends BEL, as before)
  • excepted → left unbound, so it falls through to the user's own global binding (normally keyboard-quit, but whatever they've bound — no command hardcoded)

ghostel-send-C-g itself 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 all green; new ERT test ghostel-test-c-g-exception-unbinds.
  • Live-tested in real *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 to keyboard-quit when excepted or nil-bound).
  • Confirmed the inhibit-quit/quit-flag interaction is clean: the fall-through keyboard-quit lands, quit-flag clears, no stray pending quit, no wedge.

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
dakra force-pushed the fix/489-keymap-exceptions-c-g branch from 3ad8dea to 4ceef34 Compare June 30, 2026 21:46
@dakra
dakra merged commit 4ceef34 into main Jun 30, 2026
19 checks passed
@dakra
dakra deleted the fix/489-keymap-exceptions-c-g branch June 30, 2026 21:46
@dakra
dakra temporarily deployed to github-pages June 30, 2026 21:47 — with GitHub Actions Inactive
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.

Cannot prevent C-g from being sent to the terminal

1 participant