diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-16 09:41:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-16 09:41:58 -0500 |
| commit | e5582dc043bbb283229d668e180e9d70c5d93d18 (patch) | |
| tree | 85941ea18abca6505685149bdc209e941111d136 | |
| parent | a201fa7f2e9d1fa44e0fd09886393f5d326248ea (diff) | |
| download | dotemacs-e5582dc043bbb283229d668e180e9d70c5d93d18.tar.gz dotemacs-e5582dc043bbb283229d668e180e9d70c5d93d18.zip | |
feat(keybindings): mirror the C-; command family under C-c ;
C-; is GUI-only: terminals can't encode Control-semicolon, so the whole custom command family (calendar, AI, Slack, org, pearl, jump, and the rest) was unreachable in a terminal frame (emacs -nw, emacsclient -nw, or Emacs inside vterm/tmux). I bound the single cj/custom-keymap under C-c ; alongside C-;, so the same leaf keys reach the identical map in both GUI and TTY with no relearning and no per-module edits. C-c is the standard user prefix and always TTY-encodable. I audited every leaf key in the family and they're all TTY-safe (letters, digits, punctuation, SPC, and arrow keys), so nothing needed remapping.
| -rw-r--r-- | modules/keybindings.el | 4 | ||||
| -rw-r--r-- | tests/test-keybindings-tty-mirror.el | 33 |
2 files changed, 37 insertions, 0 deletions
diff --git a/modules/keybindings.el b/modules/keybindings.el index db4800876..b61c3f2b3 100644 --- a/modules/keybindings.el +++ b/modules/keybindings.el @@ -35,6 +35,10 @@ (defvar-keymap cj/custom-keymap :doc "User custom prefix keymap base for nested keymaps.") (keymap-global-set "C-;" cj/custom-keymap) +;; C-; is GUI-only; terminals can't encode Control-semicolon. Mirror the same +;; keymap under C-c ; (the standard user prefix, always TTY-encodable) so the +;; whole command family works in a terminal frame with no leaf-key relearning. +(keymap-global-set "C-c ;" cj/custom-keymap) ;; ------------------------ Custom Keymap Registration ------------------------- diff --git a/tests/test-keybindings-tty-mirror.el b/tests/test-keybindings-tty-mirror.el new file mode 100644 index 000000000..f63024c0b --- /dev/null +++ b/tests/test-keybindings-tty-mirror.el @@ -0,0 +1,33 @@ +;;; test-keybindings-tty-mirror.el --- TTY mirror prefix for the C-; family -*- lexical-binding: t; -*- + +;;; Commentary: +;; The personal prefix C-; is GUI-only — terminals can't encode Control-semicolon, +;; so the whole custom command family is unreachable in a TTY frame (emacs -nw, +;; emacsclient -nw, Emacs inside vterm/tmux). keybindings.el binds the single +;; `cj/custom-keymap' under a TTY-safe mirror prefix C-c ; alongside C-;, so the +;; same leaf keys reach the identical map in both GUI and terminal. These tests +;; pin that load-time global binding. + +;;; Code: + +(require 'ert) + +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(require 'keybindings) + +(ert-deftest test-keybindings-tty-mirror-gui-prefix-resolves () + "Normal: the GUI prefix C-; resolves to cj/custom-keymap globally." + (should (eq (keymap-lookup (current-global-map) "C-;") cj/custom-keymap))) + +(ert-deftest test-keybindings-tty-mirror-tty-prefix-resolves () + "Normal: the TTY mirror C-c ; resolves to the same cj/custom-keymap." + (should (eq (keymap-lookup (current-global-map) "C-c ;") cj/custom-keymap))) + +(ert-deftest test-keybindings-tty-mirror-both-prefixes-share-one-map () + "Boundary: both prefixes point at the identical keymap object, so a leaf +key registered once is reachable under either prefix." + (should (eq (keymap-lookup (current-global-map) "C-;") + (keymap-lookup (current-global-map) "C-c ;")))) + +(provide 'test-keybindings-tty-mirror) +;;; test-keybindings-tty-mirror.el ends here |
