aboutsummaryrefslogtreecommitdiff
path: root/modules/term-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-05 05:43:43 -0500
committerCraig Jennings <c@cjennings.net>2026-06-05 05:43:43 -0500
commitf84f5d7958288b4a7e2fc6ccda07c77a020e0319 (patch)
tree8d8d7ed543be17f262ce4d2a3fc3481d7f29846e /modules/term-config.el
parentd2bb83228daf5301dd06732499312ca310ae1940 (diff)
downloaddotemacs-f84f5d7958288b4a7e2fc6ccda07c77a020e0319.tar.gz
dotemacs-f84f5d7958288b4a7e2fc6ccda07c77a020e0319.zip
fix(term): make F9 and F12 reach Emacs inside ghostel buffers
F9 did nothing in an agent buffer: ghostel's semi-char mode forwards every key not in ghostel-keymap-exceptions to the pty, and ghostel-semi-char-mode-map outranks the major-mode map, so the F9-family and F12 bindings I'd put in ghostel-mode-map never fired. The keys went to Claude/the shell, which ignored them. I added the F9 family (in ai-term) and F12 plus C-; (in term-config) to ghostel-keymap-exceptions and rebuilt the semi-char map with ghostel--rebuild-semi-char-keymap. add-to-list updates the list but not the already-built map, so the rebuild is what actually lets the keys through. C-; had the same latent bug for the same reason. Two regression tests assert the keys are in the exceptions and that the rebuilt semi-char map no longer forwards them. I also corrected the spec note that claimed binding in ghostel-mode-map was enough (true for vterm, wrong for ghostel) and codified the gotcha.
Diffstat (limited to 'modules/term-config.el')
-rw-r--r--modules/term-config.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/term-config.el b/modules/term-config.el
index 84ba7b3b7..b327777a5 100644
--- a/modules/term-config.el
+++ b/modules/term-config.el
@@ -53,6 +53,7 @@
(declare-function ghostel-next-prompt "ghostel" (&optional n))
(declare-function ghostel-previous-prompt "ghostel" (&optional n))
(declare-function ghostel-send-next-key "ghostel" ())
+(declare-function ghostel--rebuild-semi-char-keymap "ghostel" ())
(defvar ghostel-mode-map)
(defvar ghostel-keymap-exceptions)
(defvar ghostel-buffer-name)
@@ -220,9 +221,16 @@ run its own project-named tmux session instead of a bare, auto-named one.
:ensure t
:commands (ghostel)
:init
- ;; C-; must reach Emacs so the personal prefix keymap works in terminals.
+ ;; C-; and F12 must reach Emacs (not the terminal program) inside ghostel
+ ;; buffers. In semi-char mode ghostel forwards every key NOT in
+ ;; `ghostel-keymap-exceptions' to the pty, and `ghostel-semi-char-mode-map'
+ ;; is rebuilt from that list by `ghostel--rebuild-semi-char-keymap' --
+ ;; `add-to-list' alone updates the list but not the already-built map, so the
+ ;; rebuild is what actually lets the key through to `ghostel-mode-map'.
(with-eval-after-load 'ghostel
- (add-to-list 'ghostel-keymap-exceptions "C-;"))
+ (dolist (key '("C-;" "<f12>"))
+ (add-to-list 'ghostel-keymap-exceptions key))
+ (ghostel--rebuild-semi-char-keymap))
:hook
((ghostel-mode . cj/turn-off-chrome-for-term)
(ghostel-mode . cj/term-launch-tmux))