diff options
| -rw-r--r-- | modules/org-noter-config.el | 18 | ||||
| -rw-r--r-- | tests/test-org-noter-config-keymap.el | 43 |
2 files changed, 54 insertions, 7 deletions
diff --git a/modules/org-noter-config.el b/modules/org-noter-config.el index 0ba31bf7..ca8432a2 100644 --- a/modules/org-noter-config.el +++ b/modules/org-noter-config.el @@ -288,10 +288,14 @@ From a PDF/EPUB: starts org-noter session if inactive, then inserts note." ;;; ----------------------------- Org-Noter Keymap ----------------------------- (defvar-keymap cj/org-noter-map - :doc "Keymap for org-noter operations." - "i" #'cj/org-noter-insert-note-dwim - "n" #'org-noter-sync-next-note - "p" #'org-noter-sync-prev-note + :doc "Keymap for org-noter operations. +Insert-note (the most-used action) sits on the doubled-prefix +letter `n' so the binding reads as `C-; n n'. Sibling-stepping +moved off `n'/`p' to the angle-bracket pair `>'/`<' to free up `n' +and to read more naturally as direction." + "n" #'cj/org-noter-insert-note-dwim + ">" #'org-noter-sync-next-note + "<" #'org-noter-sync-prev-note "." #'org-noter-sync-current-note "s" #'org-noter-create-skeleton "q" #'org-noter-kill-session @@ -302,9 +306,9 @@ From a PDF/EPUB: starts org-noter session if inactive, then inserts note." (with-eval-after-load 'which-key (which-key-add-key-based-replacements "C-; n" "org-noter menu" - "C-; n i" "insert note" - "C-; n n" "sync next note" - "C-; n p" "sync prev note" + "C-; n n" "insert note" + "C-; n >" "sync next note" + "C-; n <" "sync prev note" "C-; n ." "sync current note" "C-; n s" "headings from TOC" "C-; n q" "kill session" 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 |
