diff options
| -rw-r--r-- | README.org | 12 | ||||
| -rw-r--r-- | pearl.el | 12 | ||||
| -rw-r--r-- | tests/test-pearl-keymap.el | 28 | ||||
| -rw-r--r-- | tests/test-pearl-menu.el | 4 |
4 files changed, 36 insertions, 20 deletions
@@ -163,14 +163,14 @@ The hot-path commands sit one key under the prefix; the rest are grouped into su | Key | Command | |-----------+----------------------------------------------------------------------| -| =l= | list my open issues | +| =l= | open the default view (my open issues until you set one) | | =g= | refresh the view | | =r= | refresh the issue at point | | =s= / =S= | save the issue at point / save every issue in the file | | =d= | edit the description | | =m= | open the full transient menu | | =f= ... | fetch (issue sources): =s= pick source, =o= open issues, =p= by project, =f= filter | -| =v= ... | views: =l= run local, =L= run Linear, =c= create, =e= edit, =k= delete, =u= publish, =U= publish current, =d= save Linear view locally, =D= set default (reserved) | +| =v= ... | views: =l= run local, =L= run Linear, =c= create, =e= edit, =k= delete, =u= publish, =U= publish current, =d= save Linear view locally, =D= set default | | =e= ... | edit: =d= description, =s= state, =a= assignee, =l= labels, =c= comment | | =c= ... | create: =t= issue, =c= comment | | =k= ... | delete: =t= issue, =c= comment | @@ -186,6 +186,14 @@ To reach the map outside a Pearl buffer, bind it globally as well: With =which-key=, each step shows a labeled menu. Every command is also available through =M-x=. +*** The default view + +The hot key =l= (=pearl-open-default-view=) opens whatever you've set as your default. Out of the box that's your open issues, so =l= behaves exactly as it always has until you choose otherwise. The literal my-open-issues fetch is still on =C-; L f o= if you want it regardless of the default. + +Set the default with =pearl-set-default-view= (=C-; L v D=, or =.= in the transient's Views group). From a buffer that's showing a local view it offers that view; otherwise it prompts over your local-view names, with a =[ My open issues ]= entry at the top that clears the default. The choice is saved through Customize, so it persists across restarts. To default to a Linear Custom View, save it locally first (=pearl-save-linear-view-locally=) and set the resulting local view. + +The default is =pearl-default-view= (a local-view name, or nil for my open issues). Under [[*Multiple accounts][multiple accounts]] it's per-account instead: each account carries its own =:default-view=, so =l= opens the right view for whichever account is active. If the named view has since been deleted, =l= falls back to my open issues with a message rather than erroring. + *** Sources A *source* is anything Pearl can fetch from: a Linear favorite, a Custom View, a project / cycle / label / user, a local view, or an ad-hoc filter. The everyday front door is =pearl-pick-source= (=C-; L f s=, or =P= in the transient), which lists all your Linear favorites first (in their Linear sort order) and then your local views, each tagged by kind: @@ -6734,7 +6734,8 @@ body stay." ("u" "publish local view" pearl-publish-local-view) ("D" "save Linear view locally" pearl-save-linear-view-locally) ("U" "publish current view" pearl-publish-current-view) - ("X" "delete local view" pearl-delete-local-view)] + ("X" "delete local view" pearl-delete-local-view) + ("." "set default view" pearl-set-default-view)] ["Buffer" ("g" "refresh view" pearl-refresh-current-view) ("r" "refresh issue" pearl-refresh-current-issue) @@ -6793,15 +6794,14 @@ in `pearl-views-map' so this group stays one concern.") (define-key map "u" (cons "publish local view" #'pearl-publish-local-view)) (define-key map "U" (cons "publish current view" #'pearl-publish-current-view)) (define-key map "d" (cons "save Linear view locally" #'pearl-save-linear-view-locally)) - ;; `D' (set default view) is reserved for the not-yet-built - ;; `pearl-set-default-view'. Left intentionally unbound so the slot is - ;; free when that command lands; do not bind another command to it. + (define-key map "D" (cons "set default view" #'pearl-set-default-view)) map) "Pearl view commands; a sub-keymap of `pearl-prefix-map'. Lowercase `l' / capital `L' run a local / Linear view; `c' / `e' / `k' create / edit / delete a local view. `u' / `U' publish a named / the current local view up to Linear; `d' saves a Linear view down into a new -local view. Capital `D' is reserved for set-default-view.") +local view. Capital `D' sets the default view `pearl-open-default-view' +opens.") (defvar pearl-edit-map (let ((map (make-sparse-keymap))) @@ -6858,7 +6858,7 @@ diagnostics.") (defvar pearl-prefix-map (let ((map (make-sparse-keymap))) ;; Hot path -- one key under the prefix. - (define-key map "l" (cons "list my open issues" #'pearl-list-issues)) + (define-key map "l" (cons "open default view" #'pearl-open-default-view)) (define-key map "g" (cons "refresh view" #'pearl-refresh-current-view)) (define-key map "r" (cons "refresh issue" #'pearl-refresh-current-issue)) (define-key map "s" (cons "save issue" #'pearl-save-issue)) diff --git a/tests/test-pearl-keymap.el b/tests/test-pearl-keymap.el index 643005b..9650652 100644 --- a/tests/test-pearl-keymap.el +++ b/tests/test-pearl-keymap.el @@ -48,8 +48,9 @@ Walks MAP looking for a labeled binding (\"label\" . COMMAND)." (ert-deftest test-pearl-prefix-map-direct-hot-keys () "The hot-path commands resolve in one key under the prefix. -The lowercase `c' is no longer a direct command -- it is the create prefix." - (should (eq 'pearl-list-issues (lookup-key pearl-prefix-map (kbd "l")))) +The lowercase `c' is no longer a direct command -- it is the create prefix. +`l' opens the configurable default view, not the literal my-open-issues fetch." + (should (eq 'pearl-open-default-view (lookup-key pearl-prefix-map (kbd "l")))) (should (eq 'pearl-refresh-current-view (lookup-key pearl-prefix-map (kbd "g")))) (should (eq 'pearl-refresh-current-issue (lookup-key pearl-prefix-map (kbd "r")))) (should (eq 'pearl-save-issue (lookup-key pearl-prefix-map (kbd "s")))) @@ -97,9 +98,9 @@ local view; `u'/`U' publish (copy up); `d' saves a Linear view locally (should (eq 'pearl-publish-current-view (lookup-key pearl-prefix-map (kbd "v U")))) (should (eq 'pearl-save-linear-view-locally (lookup-key pearl-prefix-map (kbd "v d"))))) -(ert-deftest test-pearl-prefix-map-views-default-slot-reserved () - "`v D' is reserved for the not-yet-built set-default-view; it stays unbound." - (should-not (lookup-key pearl-prefix-map (kbd "v D")))) +(ert-deftest test-pearl-prefix-map-views-set-default () + "`v D' binds set-default-view -- the slot the keybinding reservation held." + (should (eq 'pearl-set-default-view (lookup-key pearl-prefix-map (kbd "v D"))))) (ert-deftest test-pearl-prefix-map-edit-group () "The edit group resolves field-edit commands only -- no view edit anymore." @@ -138,14 +139,17 @@ local view; `u'/`U' publish (copy up); `d' saves a Linear view locally (should (eq 'pearl-toggle-debug (lookup-key pearl-prefix-map (kbd "w !")))) (should (eq 'pearl-clear-cache (lookup-key pearl-prefix-map (kbd "w x"))))) -(ert-deftest test-pearl-prefix-map-common-commands-bound-twice () - "The most common commands resolve both directly and inside their group." - ;; edit-description: direct d and e d +(ert-deftest test-pearl-prefix-map-hot-keys-vs-groups () + "edit-description is dual-bound; the l hot key opens the default while the +literal my-open-issues fetch stays at f o (they are no longer the same command)." + ;; edit-description: direct d and e d resolve to the same command (should (eq (lookup-key pearl-prefix-map (kbd "d")) (lookup-key pearl-prefix-map (kbd "e d")))) - ;; list issues: direct l and f o - (should (eq (lookup-key pearl-prefix-map (kbd "l")) - (lookup-key pearl-prefix-map (kbd "f o"))))) + ;; l opens the configurable default; f o is the literal fetch -- distinct now + (should (eq 'pearl-open-default-view (lookup-key pearl-prefix-map (kbd "l")))) + (should (eq 'pearl-list-issues (lookup-key pearl-prefix-map (kbd "f o")))) + (should-not (eq (lookup-key pearl-prefix-map (kbd "l")) + (lookup-key pearl-prefix-map (kbd "f o"))))) (ert-deftest test-pearl-prefix-map-which-key-labels () "Leaf bindings carry verb labels; sub-prefixes carry +labels." @@ -159,6 +163,8 @@ local view; `u'/`U' publish (copy up); `d' saves a Linear view locally (test-pearl-keymap--label-of pearl-copy-map 'pearl-copy-issue-url))) (should (string= "run local view" (test-pearl-keymap--label-of pearl-views-map 'pearl-run-local-view))) + (should (string= "set default view" + (test-pearl-keymap--label-of pearl-views-map 'pearl-set-default-view))) (should (string= "switch account" (test-pearl-keymap--label-of pearl-workspace-map 'pearl-switch-account))) (should (string= "+edit" (test-pearl-keymap--label-of pearl-prefix-map pearl-edit-map))) diff --git a/tests/test-pearl-menu.el b/tests/test-pearl-menu.el index 8e18274..48ce723 100644 --- a/tests/test-pearl-menu.el +++ b/tests/test-pearl-menu.el @@ -73,7 +73,9 @@ menu entry that still points at it fails here." ;; previously missing from the menu -- added in the ;; keybinding reconciliation so both surfaces agree pearl-switch-account - pearl-copy-issue-url)) + pearl-copy-issue-url + ;; set-default-view: the new Views-group entry + pearl-set-default-view)) (should (memq expected cmds))))) (provide 'test-pearl-menu) |
