From 3abe3e44f78124eac350c0bd7ed08cd243a0c975 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 May 2026 23:59:34 -0500 Subject: refactor(ai-vterm): retire M-F9 buffer picker; bind to cj/toggle-gptel M-F9 used to invoke `cj/ai-vterm-pick-buffer' (a buffer picker narrowed to alive AI-agent buffers). In practice the F9 plain-key toggle + C-F9 project picker covered the common cases, and the buffer picker rarely earned its keystroke. Rebind M-F9 to `cj/toggle-gptel' so the F9 family covers the two main in-Emacs AI surfaces at one keystroke each: ai-vterm toggle (unchanged) C- ai-vterm picker (unchanged) M- gptel *AI-Assistant* (NEW) Removed entirely: - `cj/ai-vterm-pick-buffer' (the command itself). - `cj/--ai-vterm-pick-buffer-candidates' (its helper). - `tests/test-ai-vterm--pick-buffer-candidates.el' (deleted). Updated: - `tests/test-ai-vterm--f9-in-vterm.el' binding assertions (vterm-mode-map and global) flipped to `cj/toggle-gptel'. - Module commentary + `cj/ai-vterm' docstring describe the new M-F9 behavior. - `cj/toggle-gptel' lives in `modules/ai-config.el'; the binding stays in `ai-vterm.el' next to the rest of the F9 family so the dispatch shape is visible in one place. --- tests/test-ai-vterm--f9-in-vterm.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/test-ai-vterm--f9-in-vterm.el') diff --git a/tests/test-ai-vterm--f9-in-vterm.el b/tests/test-ai-vterm--f9-in-vterm.el index 1355bd6a..ff8939c8 100644 --- a/tests/test-ai-vterm--f9-in-vterm.el +++ b/tests/test-ai-vterm--f9-in-vterm.el @@ -24,19 +24,24 @@ (should (eq (keymap-lookup vterm-mode-map "") #'cj/ai-vterm))) (ert-deftest test-ai-vterm-f9-family-bound-in-vterm-mode-map () - "Normal: the C-/M- F9 variants are bound in `vterm-mode-map' too." + "Normal: the C-/M- F9 variants are bound in `vterm-mode-map' too. +`M-' toggles gptel's *AI-Assistant* window (rebound here from +the old `cj/ai-vterm-pick-buffer' command, which was removed)." (should (eq (keymap-lookup vterm-mode-map "C-") #'cj/ai-vterm-pick-project)) - (should (eq (keymap-lookup vterm-mode-map "M-") #'cj/ai-vterm-pick-buffer))) + (should (eq (keymap-lookup vterm-mode-map "M-") #'cj/toggle-gptel))) (ert-deftest test-ai-vterm-f9-not-self-insert-in-vterm () "Boundary: vterm's default -> `vterm--self-insert' was overridden." (should-not (eq (keymap-lookup vterm-mode-map "") 'vterm--self-insert))) (ert-deftest test-ai-vterm-f9-still-bound-globally () - "Normal: the global F9 family bindings are intact." + "Normal: the global F9 family bindings are intact. +`' toggles the ai-vterm agent window; `C-' picks a project +agent; `M-' toggles gptel's *AI-Assistant* window (rebound from +the retired `cj/ai-vterm-pick-buffer')." (should (eq (lookup-key (current-global-map) (kbd "")) #'cj/ai-vterm)) (should (eq (lookup-key (current-global-map) (kbd "C-")) #'cj/ai-vterm-pick-project)) - (should (eq (lookup-key (current-global-map) (kbd "M-")) #'cj/ai-vterm-pick-buffer))) + (should (eq (lookup-key (current-global-map) (kbd "M-")) #'cj/toggle-gptel))) (provide 'test-ai-vterm--f9-in-vterm) ;;; test-ai-vterm--f9-in-vterm.el ends here -- cgit v1.2.3