diff options
| -rw-r--r-- | docs/specs/keybinding-console-safety-spec.org | 20 | ||||
| -rw-r--r-- | modules/eat-config.el | 10 | ||||
| -rw-r--r-- | modules/test-runner.el | 26 | ||||
| -rw-r--r-- | tests/test-term-tmux-history.el | 16 | ||||
| -rw-r--r-- | tests/test-test-runner.el | 14 |
5 files changed, 53 insertions, 33 deletions
diff --git a/docs/specs/keybinding-console-safety-spec.org b/docs/specs/keybinding-console-safety-spec.org index cec9f6c5..d0ad5c5e 100644 --- a/docs/specs/keybinding-console-safety-spec.org +++ b/docs/specs/keybinding-console-safety-spec.org @@ -540,11 +540,11 @@ Format: chord — command — what it does. - C-; s p — cj/prepend-to-lines-in-region-or-buffer - C-; s I — change-inner ; C-; s O — change-outer -*** C-; t — Test runner -- C-; t r — cj/test-run-smart ; C-; t R — cj/test-run-all ; C-; t . — cj/run-test-at-point -- C-; t a — cj/test-focus-add ; C-; t b — cj/test-focus-add-this-buffer-file -- C-; t c — cj/test-focus-clear ; C-; t v — cj/test-view-focused -- C-; t L — cj/test-load-all ; C-; t t — cj/test-toggle-mode +*** C-; T — Test runner +- C-; T r — cj/test-run-smart ; C-; T R — cj/test-run-all ; C-; T . — cj/run-test-at-point +- C-; T a — cj/test-focus-add ; C-; T b — cj/test-focus-add-this-buffer-file +- C-; T c — cj/test-focus-clear ; C-; T v — cj/test-view-focused +- C-; T L — cj/test-load-all ; C-; T t — cj/test-toggle-mode *** C-; v — Version control (git / forge) - C-; v c — cj/git-clone-clipboard-url ; C-; v d — cj/goto-git-gutter-diff-hunks @@ -557,11 +557,11 @@ Format: chord — command — what it does. - C-; w r — cj/remove-leading-trailing-whitespace ; C-; w - — cj/hyphenate-whitespace-in-region - C-; w t — untabify ; C-; w T — tabify -*** C-; x — Terminal (ghostel) -- C-; x t — cj/term-toggle ; C-; x N — ghostel (new) ; C-; x c — cj/term-copy-mode-dwim -- C-; x h — cj/term-tmux-history ; C-; x l — ghostel-clear-scrollback -- C-; x n — ghostel-next-prompt ; C-; x p — ghostel-previous-prompt -- C-; x q — ghostel-send-next-key +*** C-; t — Terminal (ghostel) +- C-; t t — cj/term-toggle ; C-; t N — ghostel (new) ; C-; t c — cj/term-copy-mode-dwim +- C-; t h — cj/term-tmux-history ; C-; t l — ghostel-clear-scrollback +- C-; t n — ghostel-next-prompt ; C-; t p — ghostel-previous-prompt +- C-; t q — ghostel-send-next-key ** Appendix B — The M-S- family (18 keys) diff --git a/modules/eat-config.el b/modules/eat-config.el index f764848e..72f27bda 100644 --- a/modules/eat-config.el +++ b/modules/eat-config.el @@ -414,9 +414,9 @@ terminal. ai-term's agent buffers are managed separately via M-SPC." ;; ------------------- terminal copy mode + tmux history ----------------------- ;; Carried over from the ghostel era for the EAT agent terminals (ai-term). ;; Agents run EAT over tmux, so copy-mode is tmux's own copy-mode -- the same UX -;; ghostel-over-tmux had. C-<up> enters it and scrolls up in one stroke; C-; x c -;; enters it via the menu, C-; x h grabs the whole pane history into a buffer, -;; and C-; x d detaches the tmux client without going through its prefix. +;; ghostel-over-tmux had. C-<up> enters it and scrolls up in one stroke; C-; t c +;; enters it via the menu, C-; t h grabs the whole pane history into a buffer, +;; and C-; t d detaches the tmux client without going through its prefix. (declare-function cj/register-prefix-map "keybindings") (declare-function eat-emacs-mode "eat") @@ -628,13 +628,13 @@ pty; without tmux, moves point up in EAT's emacs-mode buffer." (cj/term-copy-mode-dwim)) (forward-line -1))))) -;; The C-; x terminal prefix (copy-mode, tmux detach, tmux history, the F12 +;; The C-; t terminal prefix (copy-mode, tmux detach, tmux history, the F12 ;; toggle). C-<up> ;; enters copy-mode + scrolls in one stroke; bound in EAT's semi-char map so it ;; reaches Emacs from inside an agent terminal. (defvar-keymap cj/term-map :doc "Personal terminal command map.") -(cj/register-prefix-map "x" cj/term-map) +(cj/register-prefix-map "t" cj/term-map "terminal menu") (keymap-set cj/term-map "c" #'cj/term-copy-mode-dwim) (keymap-set cj/term-map "d" #'cj/term-tmux-detach) (keymap-set cj/term-map "h" #'cj/term-tmux-history) diff --git a/modules/test-runner.el b/modules/test-runner.el index 6cb35275..54d56974 100644 --- a/modules/test-runner.el +++ b/modules/test-runner.el @@ -6,7 +6,7 @@ ;; Layer: 2 (Core UX). ;; Category: C/L. ;; Load shape: eager. -;; Eager reason: registers the C-; t test runner entry point and state. +;; Eager reason: registers the C-; T test runner entry point and state. ;; Top-level side effects: defines and registers cj/test-map. ;; Runtime requires: ert, cl-lib, keybindings, system-lib. ;; Direct test load: yes. @@ -15,7 +15,7 @@ ;; Test roots come from Projectile projects, falling back to the config's tests ;; directory, and test files are discovered by the test-*.el convention. ;; -;; Commands under C-; t load tests, run all/focused tests, run the test at point, +;; Commands under C-; T load tests, run all/focused tests, run the test at point, ;; and manage the per-project focus list. ;;; Code: @@ -490,21 +490,21 @@ Returns the number of tests deleted." "v" #'cj/test-view-focused "t" #'cj/test-toggle-mode) -(cj/register-prefix-map "t" cj/testrunner-map) +(cj/register-prefix-map "T" cj/testrunner-map) ;; which-key integration (with-eval-after-load 'which-key (which-key-add-key-based-replacements - "C-; t" "test runner menu" - "C-; t L" "load all tests" - "C-; t R" "run all tests" - "C-; t r" "run smart" - "C-; t ." "run test at point" - "C-; t a" "add to focus" - "C-; t b" "add buffer to focus" - "C-; t c" "clear focus" - "C-; t v" "view focused" - "C-; t t" "toggle mode")) + "C-; T" "test runner menu" + "C-; T L" "load all tests" + "C-; T R" "run all tests" + "C-; T r" "run smart" + "C-; T ." "run test at point" + "C-; T a" "add to focus" + "C-; T b" "add buffer to focus" + "C-; T c" "clear focus" + "C-; T v" "view focused" + "C-; T t" "toggle mode")) (provide 'test-runner) ;;; test-runner.el ends here diff --git a/tests/test-term-tmux-history.el b/tests/test-term-tmux-history.el index a5f5c93c..5e2bc52c 100644 --- a/tests/test-term-tmux-history.el +++ b/tests/test-term-tmux-history.el @@ -3,7 +3,7 @@ ;;; Commentary: ;; Exercises the terminal UX carried into eat-config for the EAT agent ;; terminals: the Emacs-owned tmux history buffer, the copy-mode-dwim engine -;; pick, the tmux pane-id / attached-client predicates, and the C-; x menu +;; pick, the tmux pane-id / attached-client predicates, and the C-; t menu ;; bindings. Agents run EAT over tmux, so copy-mode is tmux's own copy-mode. ;; ;; eat is required (so eat-config's `with-eval-after-load' fires for the C-<up> @@ -263,10 +263,16 @@ up-arrow -- it does not re-enter and reset the cursor." ;;; bindings (ert-deftest test-term-keymap-history-and-copy-bindings () - "Normal: the C-; x terminal map owns the tmux-history and copy-mode commands." - (should (eq (keymap-lookup cj/custom-keymap "x h") #'cj/term-tmux-history)) - (should (eq (keymap-lookup cj/custom-keymap "x c") #'cj/term-copy-mode-dwim)) - (should (eq (keymap-lookup cj/custom-keymap "x t") #'cj/term-toggle))) + "Normal: the C-; t terminal map owns the tmux-history and copy-mode commands." + (should (eq (keymap-lookup cj/custom-keymap "t") cj/term-map)) + (should (eq (keymap-lookup cj/custom-keymap "t h") #'cj/term-tmux-history)) + (should (eq (keymap-lookup cj/custom-keymap "t c") #'cj/term-copy-mode-dwim)) + (should (eq (keymap-lookup cj/custom-keymap "t d") #'cj/term-tmux-detach)) + (should (eq (keymap-lookup cj/custom-keymap "t t") #'cj/term-toggle))) + +(ert-deftest test-term-keymap-old-x-prefix-is-gone () + "Boundary: the terminal map no longer answers on its old C-; x prefix." + (should-not (eq (keymap-lookup cj/custom-keymap "x") cj/term-map))) (ert-deftest test-term-copy-mode-up-bound-in-eat-semi-char-map () "Normal: C-<up> enters copy-mode + scrolls up from inside an EAT terminal." diff --git a/tests/test-test-runner.el b/tests/test-test-runner.el index 6854b72e..c5416352 100644 --- a/tests/test-test-runner.el +++ b/tests/test-test-runner.el @@ -497,5 +497,19 @@ comparing against the directory with a trailing slash rejects it." (ert-delete-test 'test-testrunner-project-names-b)))) (test-testrunner-teardown)) +;;; bindings + +(ert-deftest test-testrunner-prefix-is-capital-t () + "Normal: the test runner map sits on C-; T with its commands under it." + (should (eq (keymap-lookup cj/custom-keymap "T") cj/testrunner-map)) + (should (eq (keymap-lookup cj/custom-keymap "T r") #'cj/test-run-smart)) + (should (eq (keymap-lookup cj/custom-keymap "T R") #'cj/test-run-all)) + (should (eq (keymap-lookup cj/custom-keymap "T .") #'cj/run-test-at-point)) + (should (eq (keymap-lookup cj/custom-keymap "T t") #'cj/test-toggle-mode))) + +(ert-deftest test-testrunner-lowercase-t-prefix-is-released () + "Boundary: the test runner no longer claims C-; t, which the terminal owns." + (should-not (eq (keymap-lookup cj/custom-keymap "t") cj/testrunner-map))) + (provide 'test-test-runner) ;;; test-test-runner.el ends here |
