aboutsummaryrefslogtreecommitdiff
path: root/tests/test-ai-vterm--dispatch.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-11 07:18:20 -0500
committerCraig Jennings <c@cjennings.net>2026-05-11 07:18:20 -0500
commit59b0854464ef29511a0d09f1e76fd1140e675833 (patch)
tree0c18aee463b4ff14f2fa6675e2cde6fc5f50bbdc /tests/test-ai-vterm--dispatch.el
parentde555fa8b48c5ed5f17c0a8db9de7ecb946aa75d (diff)
downloaddotemacs-59b0854464ef29511a0d09f1e76fd1140e675833.tar.gz
dotemacs-59b0854464ef29511a0d09f1e76fd1140e675833.zip
refactor(ai-vterm): rename Claude-specific names to a generic "agent"
I may add other terminal agents to this launcher (aider, an open-source LLM TUI), so the buffer prefix, the user knob, and the internal helpers shouldn't say "Claude". The module name (ai-vterm) and the `cj/ai-vterm-*` customs were already generic. This finishes the job: - buffer prefix `claude [<basename>]` -> `agent [<basename>]` (the `defconst` and the matching display-buffer-alist regex move together) - `cj/ai-vterm-claude-command` -> `cj/ai-vterm-agent-command` (the default still runs the `claude` CLI, with a docstring note on swapping it) - `cj/--ai-vterm-claude-buffers` / `-displayed-claude-window` / `-reuse-existing-claude` -> `-agent-*`, and their test files renamed to match - prose in the module commentary and docstrings, plus the matching test docstrings and buffer-name literals `vterm-config.el` hardcodes the same buffer prefix in `cj/--vterm-toggle-buffer-p` (F12 excludes agent buffers from its candidate set), so that literal moved too. Collapsing it into the shared `cj/--ai-vterm-name-prefix` is a cleanup for another day. After a reload, a project's buffer opens as `agent [foo]` instead of `claude [foo]`. Old buffers keep their names until killed. I also corrected two stale `eshell-vterm-config.el` references in ai-vterm.el docstrings (that module was split into `vterm-config.el`). Two things keep saying "Claude": the `cj/ai-vterm-agent-command` default value (the actual CLI), and the "Claude Code" example in `vterm-config.el`'s cursor-restore docstring (a concrete TUI example, not branding). 90 tests pass. `make validate-modules` clean.
Diffstat (limited to 'tests/test-ai-vterm--dispatch.el')
-rw-r--r--tests/test-ai-vterm--dispatch.el42
1 files changed, 21 insertions, 21 deletions
diff --git a/tests/test-ai-vterm--dispatch.el b/tests/test-ai-vterm--dispatch.el
index 8871af9a..94b02123 100644
--- a/tests/test-ai-vterm--dispatch.el
+++ b/tests/test-ai-vterm--dispatch.el
@@ -3,8 +3,8 @@
;;; Commentary:
;; The dispatch helper is a pure decision function used by F9.
;; Returns one of (toggle-off . WIN), (redisplay-recent . BUF),
-;; or (pick-project) based on whether a claude buffer is currently
-;; displayed and whether any alive claude buffers exist. Tests mock
+;; or (pick-project) based on whether an agent buffer is currently
+;; displayed and whether any alive agent buffers exist. Tests mock
;; the two underlying helpers so the dispatch logic can be exercised
;; without touching real windows.
@@ -19,38 +19,38 @@
(require 'testutil-vterm-buffers)
(ert-deftest test-ai-vterm--dispatch-window-displayed-returns-toggle-off ()
- "Normal: displayed claude window -> (toggle-off . WIN)."
+ "Normal: displayed agent window -> (toggle-off . WIN)."
(let ((sentinel-win 'fake-window))
- (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-claude-window)
+ (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-agent-window)
(lambda (&optional _frame) sentinel-win)))
(should (equal (cj/--ai-vterm-dispatch)
(cons 'toggle-off sentinel-win))))))
(ert-deftest test-ai-vterm--dispatch-no-window-single-buffer-returns-redisplay-recent ()
- "Normal: no displayed claude, one alive buffer -> redisplay-recent + buffer."
- (cj/test--kill-claude-buffers)
- (let ((b1 (get-buffer-create "claude [single]")))
+ "Normal: no displayed agent, one alive buffer -> redisplay-recent + buffer."
+ (cj/test--kill-agent-buffers)
+ (let ((b1 (get-buffer-create "agent [single]")))
(unwind-protect
- (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-claude-window)
+ (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-agent-window)
(lambda (&optional _frame) nil))
- ((symbol-function 'cj/--ai-vterm-claude-buffers)
+ ((symbol-function 'cj/--ai-vterm-agent-buffers)
(lambda () (list b1))))
(should (equal (cj/--ai-vterm-dispatch)
(cons 'redisplay-recent b1))))
(kill-buffer b1))))
(ert-deftest test-ai-vterm--dispatch-no-window-multiple-buffers-returns-redisplay-recent ()
- "Normal: no displayed claude, 2+ alive buffers -> redisplay-recent + MRU.
-F9 redisplays the most-recently-selected claude (head of buffer-list
+ "Normal: no displayed agent, 2+ alive buffers -> redisplay-recent + MRU.
+F9 redisplays the most-recently-selected agent (head of buffer-list
order) rather than opening the project picker, so the user toggles
-THE claude they were last using. Other claudes are reachable via M-F9."
- (cj/test--kill-claude-buffers)
- (let ((b1 (get-buffer-create "claude [a]"))
- (b2 (get-buffer-create "claude [b]")))
+THE agent they were last using. Other agents are reachable via M-F9."
+ (cj/test--kill-agent-buffers)
+ (let ((b1 (get-buffer-create "agent [a]"))
+ (b2 (get-buffer-create "agent [b]")))
(unwind-protect
- (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-claude-window)
+ (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-agent-window)
(lambda (&optional _frame) nil))
- ((symbol-function 'cj/--ai-vterm-claude-buffers)
+ ((symbol-function 'cj/--ai-vterm-agent-buffers)
(lambda () (list b1 b2))))
(should (equal (cj/--ai-vterm-dispatch)
(cons 'redisplay-recent b1))))
@@ -58,11 +58,11 @@ THE claude they were last using. Other claudes are reachable via M-F9."
(kill-buffer b2))))
(ert-deftest test-ai-vterm--dispatch-no-window-zero-buffers-returns-pick-project ()
- "Boundary: no displayed claude, zero alive buffers -> pick-project."
- (cj/test--kill-claude-buffers)
- (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-claude-window)
+ "Boundary: no displayed agent, zero alive buffers -> pick-project."
+ (cj/test--kill-agent-buffers)
+ (cl-letf (((symbol-function 'cj/--ai-vterm-displayed-agent-window)
(lambda (&optional _frame) nil))
- ((symbol-function 'cj/--ai-vterm-claude-buffers)
+ ((symbol-function 'cj/--ai-vterm-agent-buffers)
(lambda () nil)))
(should (equal (cj/--ai-vterm-dispatch) '(pick-project)))))