From c38889aa4a2696df09d9f29ef9fae20335780f1d Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 15 May 2026 00:47:27 -0500 Subject: refactor(org-noter-config): rebind insert-note to n; sync to angle brackets `cj/org-noter-insert-note-dwim' is the most-used action in a noter session; it deserves the doubled-prefix letter. Move it from `C-; n i' to `C-; n n'. Sibling-stepping moves off `n'/`p' (which were sync-next / sync-prev) onto the angle-bracket pair `>'/`<' to free up `n' and to read more naturally as direction. `.' stays as sync-current-note. Updated `which-key' labels to match. Four new ERT tests in `tests/test-org-noter-config-keymap.el' lock the keymap shape so a casual edit doesn't silently drift the layout. --- tests/test-org-noter-config-keymap.el | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test-org-noter-config-keymap.el (limited to 'tests') diff --git a/tests/test-org-noter-config-keymap.el b/tests/test-org-noter-config-keymap.el new file mode 100644 index 00000000..1ad2ada9 --- /dev/null +++ b/tests/test-org-noter-config-keymap.el @@ -0,0 +1,43 @@ +;;; test-org-noter-config-keymap.el --- Lock the cj/org-noter-map shape -*- lexical-binding: t; -*- + +;;; Commentary: +;; Pins the bindings under `C-; n' so a casual edit doesn't drift the +;; layout without intent. Mnemonic: the most-used action (insert +;; note) sits on the doubled-prefix letter `n', sibling-stepping goes +;; on the angle-bracket pair, and `.' stays the "this entry" key. + +;;; Code: + +(require 'ert) + +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(require 'org-noter-config) + +(ert-deftest test-org-noter-keymap-insert-note-on-doubled-n () + "Normal: `C-; n n' invokes the insert-note command (the most-used +action, on the doubled-prefix letter)." + (should (eq (keymap-lookup cj/org-noter-map "n") + #'cj/org-noter-insert-note-dwim))) + +(ert-deftest test-org-noter-keymap-sync-siblings-on-angle-brackets () + "Normal: sibling-stepping lives on `>' (next) and `<' (prev). +The angle brackets read naturally as direction; this freed up `n' +and `p' for the insert and other future actions." + (should (eq (keymap-lookup cj/org-noter-map ">") + #'org-noter-sync-next-note)) + (should (eq (keymap-lookup cj/org-noter-map "<") + #'org-noter-sync-prev-note))) + +(ert-deftest test-org-noter-keymap-sync-current-stays-on-dot () + "Normal: `.' still invokes `org-noter-sync-current-note'." + (should (eq (keymap-lookup cj/org-noter-map ".") + #'org-noter-sync-current-note))) + +(ert-deftest test-org-noter-keymap-no-stale-i-binding () + "Regression: the old `i' binding for insert-note is gone (insert +moved to `n'). Leaving `i' around would create two ways to invoke +the same command and a stale which-key hint." + (should-not (keymap-lookup cj/org-noter-map "i"))) + +(provide 'test-org-noter-config-keymap) +;;; test-org-noter-config-keymap.el ends here -- cgit v1.2.3