aboutsummaryrefslogtreecommitdiff
path: root/tests/test-ai-term--f9-in-term.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-05 05:28:58 -0500
committerCraig Jennings <c@cjennings.net>2026-06-05 05:28:58 -0500
commitebdf9e466b0e1f86e9b7d76650ac32408273e7a7 (patch)
treedab9b453f3a93c324b5388b3843502a088c7ed46 /tests/test-ai-term--f9-in-term.el
parentc094b2e4e64530379a9cb273303308a9affcabf6 (diff)
downloaddotemacs-ebdf9e466b0e1f86e9b7d76650ac32408273e7a7.tar.gz
dotemacs-ebdf9e466b0e1f86e9b7d76650ac32408273e7a7.zip
feat(term): replace vterm with ghostel as the terminal engine
I swapped the terminal engine from vterm to ghostel (libghostty-vt) everywhere. term-config replaces vterm-config (the F12 terminal, the C-; x menu, tmux history capture), and ai-term replaces ai-vterm (the F9 Claude-agent launcher). ghostel renders the agent TUI without vterm's flicker under heavy streaming, and one engine now covers every terminal workflow. Two behavior changes fall out of the swap. F9 launches in a terminal frame now: ghostel renders in TTY frames, so the old GUI-only guard is gone. Terminal windows no longer dim when unfocused: ghostel resolves its palette into the native module per-terminal, so there's no per-window color hook to dim through the way vterm had. auto-dim drops its vterm color-advice path, the dashboard Terminal button launches ghostel, and the vterm and vterm-toggle packages are removed. The tmux pane-history and copy-mode machinery carried over unchanged. It keys on the pty tty, which ghostel exposes.
Diffstat (limited to 'tests/test-ai-term--f9-in-term.el')
-rw-r--r--tests/test-ai-term--f9-in-term.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/test-ai-term--f9-in-term.el b/tests/test-ai-term--f9-in-term.el
new file mode 100644
index 00000000..53e1c4e7
--- /dev/null
+++ b/tests/test-ai-term--f9-in-term.el
@@ -0,0 +1,45 @@
+;;; test-ai-term--f9-in-term.el --- F9 reaches Emacs from inside an agent buffer -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; ghostel's semi-char mode forwards keys not in `ghostel-keymap-exceptions' to
+;; the terminal program, so a plain <f9> typed while point is in an agent
+;; buffer would be sent to the program instead of toggling the agent -- exactly
+;; the case when the agent buffer fills the frame. `ai-term.el' re-binds the F9
+;; family in `ghostel-mode-map'. These tests require ghostel (which defines
+;; `ghostel-mode-map' and lets ai-term's `with-eval-after-load' fire) BEFORE
+;; ai-term, then confirm the bindings landed (and the global ones are intact).
+;; `(require 'ghostel)' does not load the native module, so this stays light.
+
+;;; Code:
+
+(require 'ert)
+(require 'package)
+
+(setq package-user-dir (expand-file-name "elpa" user-emacs-directory))
+(package-initialize)
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+(require 'ghostel)
+(require 'ai-term)
+
+(ert-deftest test-ai-term-f9-bound-in-ghostel-mode-map ()
+ "Normal: <f9> in `ghostel-mode-map' runs the agent toggle."
+ (should (eq (keymap-lookup ghostel-mode-map "<f9>") #'cj/ai-term)))
+
+(ert-deftest test-ai-term-f9-family-bound-in-ghostel-mode-map ()
+ "Normal: the C-/M-/C-S- F9 variants are bound in `ghostel-mode-map' too.
+`M-<f9>' and `C-S-<f9>' both close an agent via `cj/ai-term-close'."
+ (should (eq (keymap-lookup ghostel-mode-map "C-<f9>") #'cj/ai-term-pick-project))
+ (should (eq (keymap-lookup ghostel-mode-map "M-<f9>") #'cj/ai-term-close))
+ (should (eq (keymap-lookup ghostel-mode-map "C-S-<f9>") #'cj/ai-term-close)))
+
+(ert-deftest test-ai-term-f9-still-bound-globally ()
+ "Normal: the global F9 family bindings are intact.
+`<f9>' toggles the ai-term agent window; `C-<f9>' picks a project
+agent; `M-<f9>' and `C-S-<f9>' close an agent via `cj/ai-term-close'."
+ (should (eq (lookup-key (current-global-map) (kbd "<f9>")) #'cj/ai-term))
+ (should (eq (lookup-key (current-global-map) (kbd "C-<f9>")) #'cj/ai-term-pick-project))
+ (should (eq (lookup-key (current-global-map) (kbd "M-<f9>")) #'cj/ai-term-close))
+ (should (eq (lookup-key (current-global-map) (kbd "C-S-<f9>")) #'cj/ai-term-close)))
+
+(provide 'test-ai-term--f9-in-term)
+;;; test-ai-term--f9-in-term.el ends here