aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-28 03:39:46 -0400
committerCraig Jennings <c@cjennings.net>2026-06-28 03:39:46 -0400
commit9b3438d21ecc1b0527ec4bd298a61a8b124ce1c6 (patch)
tree9b79371dee6fbac8faaf51a683a122b8b7624523 /tests
parenta06b9178a27a6cf0524644822491f57398d92c2c (diff)
downloaddotemacs-9b3438d21ecc1b0527ec4bd298a61a8b124ce1c6.tar.gz
dotemacs-9b3438d21ecc1b0527ec4bd298a61a8b124ce1c6.zip
refactor(system-commands): bind C-; ! to the menu, drop the leaf keys
C-; ! was a prefix map with per-command leaf keys (s/r/e/l/L/E/S) I rarely use. I bound C-; ! directly to the completing-read menu instead and removed the leaf keys, reclaiming the real-estate. Every command stays reachable through the menu. Updated the commentary and the two keymap tests to the new contract.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-system-commands-keymap.el37
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/test-system-commands-keymap.el b/tests/test-system-commands-keymap.el
index ac78a25d5..82be1d8de 100644
--- a/tests/test-system-commands-keymap.el
+++ b/tests/test-system-commands-keymap.el
@@ -2,8 +2,9 @@
;;; Commentary:
-;; The system command keymap should remain mounted as a prefix under C-; ! so
-;; which-key can show the documented subcommands.
+;; C-; ! is bound directly to the completing-read menu. The per-command leaf
+;; keys (s/r/e/l/L/E/S) were removed to reclaim the key real-estate; every
+;; command stays reachable through the menu (see the menu-dispatch test).
;;; Code:
@@ -14,23 +15,21 @@
(require 'system-commands)
-(ert-deftest test-system-commands-keymap-normal-prefix-mounted ()
- "Normal: C-; ! remains a prefix keymap, not a direct command."
- (should (eq (keymap-lookup cj/custom-keymap "!")
- cj/system-command-map)))
-
-(ert-deftest test-system-commands-keymap-normal-documented-subkeys ()
- "Normal: documented system command subkeys resolve under the prefix."
- (dolist (binding '(("!" . cj/system-command-menu)
- ("L" . cj/system-cmd-logout)
- ("r" . cj/system-cmd-reboot)
- ("s" . cj/system-cmd-shutdown)
- ("S" . cj/system-cmd-suspend)
- ("l" . cj/system-cmd-lock)
- ("E" . cj/system-cmd-exit-emacs)
- ("e" . cj/system-cmd-restart-emacs)))
- (should (eq (keymap-lookup cj/system-command-map (car binding))
- (cdr binding)))))
+(ert-deftest test-system-commands-keymap-normal-menu-bound-directly ()
+ "Normal: C-; ! is the completing-read menu command, not a prefix keymap."
+ (let ((binding (keymap-lookup cj/custom-keymap "!")))
+ (should (eq binding 'cj/system-command-menu))
+ (should (commandp binding))))
+
+(ert-deftest test-system-commands-keymap-normal-leaf-subkeys-removed ()
+ "Normal: no subkeys hang off C-; !, and the commands remain defined."
+ ;; "!" is now a command, not a prefix, so there is no submap to walk into.
+ (should-not (keymapp (keymap-lookup cj/custom-keymap "!")))
+ ;; The commands themselves stay defined and reachable via the menu.
+ (dolist (cmd '(cj/system-cmd-logout cj/system-cmd-reboot cj/system-cmd-shutdown
+ cj/system-cmd-suspend cj/system-cmd-lock cj/system-cmd-exit-emacs
+ cj/system-cmd-restart-emacs))
+ (should (fboundp cmd))))
(provide 'test-system-commands-keymap)
;;; test-system-commands-keymap.el ends here