diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-15 00:47:27 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-15 00:47:27 -0500 |
| commit | c38889aa4a2696df09d9f29ef9fae20335780f1d (patch) | |
| tree | 5eb04b85eb30418c19dad207f1e2011789b5f7ce /tests/test-org-noter-config-keymap.el | |
| parent | 4d1b8bf9daa5353151b55060b978634d7049d886 (diff) | |
| download | dotemacs-c38889aa4a2696df09d9f29ef9fae20335780f1d.tar.gz dotemacs-c38889aa4a2696df09d9f29ef9fae20335780f1d.zip | |
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.
Diffstat (limited to 'tests/test-org-noter-config-keymap.el')
| -rw-r--r-- | tests/test-org-noter-config-keymap.el | 43 |
1 files changed, 43 insertions, 0 deletions
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 |
