From 806dbd321ce0748309c974e98dba0ea146e9d0f4 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 5 Jun 2026 05:43:43 -0500 Subject: 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. --- tests/test-term-tmux-history.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/test-term-tmux-history.el') diff --git a/tests/test-term-tmux-history.el b/tests/test-term-tmux-history.el index 2c9c38f8..49296b42 100644 --- a/tests/test-term-tmux-history.el +++ b/tests/test-term-tmux-history.el @@ -308,5 +308,14 @@ its own copy-mode against the full pane history." (when (buffer-live-p agent) (kill-buffer agent))))) +(ert-deftest test-term-prefix-and-f12-in-keymap-exceptions () + "Regression: C-; and F12 are in `ghostel-keymap-exceptions' and the rebuilt +semi-char map no longer forwards them to the pty, so the prefix keymap and the +F12 toggle reach Emacs inside ghostel buffers." + (dolist (key '("C-;" "")) + (should (member key ghostel-keymap-exceptions))) + (should-not (eq (keymap-lookup ghostel-semi-char-mode-map "") + 'ghostel--send-event))) + (provide 'test-term-tmux-history) ;;; test-term-tmux-history.el ends here -- cgit v1.2.3