aboutsummaryrefslogtreecommitdiff
path: root/tests/testutil-vterm-buffers.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-31 16:20:34 -0500
committerCraig Jennings <c@cjennings.net>2026-05-31 16:20:34 -0500
commit4e924fddebf3ccbfe41fda437ef0ca02cfed4e58 (patch)
treefbf5b0c27c749eeb65b806ddc693eb2cd48f3199 /tests/testutil-vterm-buffers.el
parentda012721c84117c83b11ea52176a5032d187e442 (diff)
downloaddotemacs-4e924fddebf3ccbfe41fda437ef0ca02cfed4e58.tar.gz
dotemacs-4e924fddebf3ccbfe41fda437ef0ca02cfed4e58.zip
feat(ai-vterm): gate the F9 launcher to GUI frames
AI-vterm launches a graphical vterm side window, so F9 / C-F9 / M-F9 now decline with a message in a terminal frame instead of opening a vterm. The guard checks the current frame at command time rather than at load. That matters under the daemon, which serves GUI and terminal frames both with display-graphic-p nil at load, so a load-time gate would have disabled the launcher in its GUI frames too. Routed the three window-behavior tests through a GUI-frame stub, since a batch run is itself a terminal frame.
Diffstat (limited to 'tests/testutil-vterm-buffers.el')
-rw-r--r--tests/testutil-vterm-buffers.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/testutil-vterm-buffers.el b/tests/testutil-vterm-buffers.el
index 01a65d906..17f0a69a0 100644
--- a/tests/testutil-vterm-buffers.el
+++ b/tests/testutil-vterm-buffers.el
@@ -9,6 +9,19 @@
;;; Code:
+(require 'cl-lib)
+
+(defun cj/test--call-as-gui (fn)
+ "Call FN with `env-terminal-p' stubbed to return nil (a GUI frame).
+
+The AI-vterm interactive commands refuse to run in a terminal frame
+via `cj/--ai-vterm-refuse-in-terminal'. A batch test run is itself a
+terminal frame, so tests that exercise the GUI-frame window behavior
+of those commands call them through this helper to present a GUI
+context."
+ (cl-letf (((symbol-function 'env-terminal-p) (lambda () nil)))
+ (funcall fn)))
+
(defun cj/test--kill-buffers-matching-prefix (prefix)
"Kill all live buffers whose name starts with PREFIX."
(dolist (b (buffer-list))