aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-06 15:37:22 -0500
committerCraig Jennings <c@cjennings.net>2026-06-06 15:37:22 -0500
commit9564501efe2488b9136dc19a7a8d385b8b074b46 (patch)
tree86a6a0d5a3eb8a2156b891655562eec14e32dcc3
parent36c364111ae7d1da72393669c68e29e1b27e91dc (diff)
downloadpearl-9564501efe2488b9136dc19a7a8d385b8b074b46.tar.gz
pearl-9564501efe2488b9136dc19a7a8d385b8b074b46.zip
feat(keys): bind sort and grouping under the views prefix
The interactive view-shaping commands shipped M-x-only. I bound them in the views sub-map so they're reachable from the keyboard: C-; L v s sorts, C-; L v g groups, C-; L v r reverses the sort order, with matching which-key labels. They sit in the views group because there's no dedicated view-shaping group. Opening one means reopening the whole keymap-prefix question that's already parked. So they reshape the active buffer from under a "views" prefix that otherwise manages saved views, a slight category stretch called out in the map's docstring. The transient menu still omits both, pending the same keymap-shape pass.
-rw-r--r--README.org6
-rw-r--r--pearl.el6
-rw-r--r--tests/test-pearl-keymap.el12
3 files changed, 20 insertions, 4 deletions
diff --git a/README.org b/README.org
index 12b28a9..d2705db 100644
--- a/README.org
+++ b/README.org
@@ -171,7 +171,7 @@ The hot-path commands sit one key under the prefix; the rest are grouped into su
| =@= | mention a Linear user (=@displayName=) at point |
| =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 |
+| =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, =s= sort, =g= group, =r= reverse order |
| =e= ... | edit: =d= description, =s= state, =a= assignee, =l= labels, =c= comment |
| =c= ... | create: =t= issue, =c= comment |
| =k= ... | delete: =t= issue, =c= comment |
@@ -299,13 +299,13 @@ Sorting is local and deterministic. Query filters are AND-only; use a Linear Cus
=pearl-set-sort= reorders the active view without hand-editing a source. It asks for a key (=updated=, =created=, =priority=, =title=) and an order (=desc= / =asc=). =pearl-toggle-sort-order= flips the order on the current sort, defaulting to =updated= descending when nothing is set yet.
-Priority and title sort the fetched issues in place: whole subtrees move by id, so unsaved edits survive, and the order sticks across a refresh. Updated and created refetch with the new server ordering. A Custom View has no server-side order in Linear's API, so =updated= / =created= are refused on a view -- sort it by priority or title instead, which still reorders the issues it returned. Sorting a grouped view in place isn't supported yet. Both commands are =M-x= for now. A key binding lands once the menu layout settles.
+Priority and title sort the fetched issues in place: whole subtrees move by id, so unsaved edits survive, and the order sticks across a refresh. Updated and created refetch with the new server ordering. A Custom View has no server-side order in Linear's API, so =updated= / =created= are refused on a view -- sort it by priority or title instead, which still reorders the issues it returned. Sorting a grouped view in place isn't supported yet. =pearl-set-sort= is on =C-; L v s= and =pearl-toggle-sort-order= on =C-; L v r=; both also run from =M-x=. They're not in the transient menu yet.
*** Grouping the current view
=pearl-set-grouping= sections the active view on demand, without setting up grouping in Linear and re-fetching. It asks for a dimension: =status=, =project=, =assignee=, =priority=, or =none= to ungroup. The regroup is client-side over the issues already in the buffer, so it's instant and works offline. Each issue's group comes from its drawer, and an issue with no value for the dimension lands in a "No status" / "No project" / "No assignee" bucket. The choice sticks across a refresh.
-Like sorting, the regroup moves whole subtrees so unsaved edits survive. Only the heading levels shift, since a grouped issue sits one level deeper under its group heading. On a Custom View that already carries its own grouping from Linear, your choice takes over for display, and =none= restores the view's configured grouping on the next refresh. =cycle= isn't offered yet: it isn't stored in the issue drawer, so an offline regroup can't read it. The command is =M-x= for now, with a key binding to come.
+Like sorting, the regroup moves whole subtrees so unsaved edits survive. Only the heading levels shift, since a grouped issue sits one level deeper under its group heading. On a Custom View that already carries its own grouping from Linear, your choice takes over for display, and =none= restores the view's configured grouping on the next refresh. =cycle= isn't offered yet: it isn't stored in the issue drawer, so an offline regroup can't read it. =pearl-set-grouping= is on =C-; L v g=, and also runs from =M-x=. It's not in the transient menu yet.
*** Editing issues
diff --git a/pearl.el b/pearl.el
index ed183dd..236c95d 100644
--- a/pearl.el
+++ b/pearl.el
@@ -8092,13 +8092,17 @@ point. View-movement commands (run / publish / save-locally) live in
(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))
(define-key map "D" (cons "set default view" #'pearl-set-default-view))
+ (define-key map "s" (cons "sort view" #'pearl-set-sort))
+ (define-key map "g" (cons "group view" #'pearl-set-grouping))
+ (define-key map "r" (cons "reverse order" #'pearl-toggle-sort-order))
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' sets the default view `pearl-open-default-view'
-opens.")
+opens. `s' / `g' shape the active buffer (sort / group); `r' reverses the
+sort order.")
(defvar pearl-edit-map
(let ((map (make-sparse-keymap)))
diff --git a/tests/test-pearl-keymap.el b/tests/test-pearl-keymap.el
index 49dbd31..6107d9f 100644
--- a/tests/test-pearl-keymap.el
+++ b/tests/test-pearl-keymap.el
@@ -221,5 +221,17 @@ literal my-open-issues fetch stays at f o (they are no longer the same command).
(pearl--maybe-enable-mode)
(should-not pearl-mode)))
+(ert-deftest test-pearl-views-map-shaping-bindings ()
+ "The views sub-map binds the view-shaping commands: sort, group, reverse order."
+ (should (eq 'pearl-set-sort (lookup-key pearl-views-map (kbd "s"))))
+ (should (eq 'pearl-set-grouping (lookup-key pearl-views-map (kbd "g"))))
+ (should (eq 'pearl-toggle-sort-order (lookup-key pearl-views-map (kbd "r"))))
+ (should (string= "sort view"
+ (test-pearl-keymap--label-of pearl-views-map 'pearl-set-sort)))
+ (should (string= "group view"
+ (test-pearl-keymap--label-of pearl-views-map 'pearl-set-grouping)))
+ (should (string= "reverse order"
+ (test-pearl-keymap--label-of pearl-views-map 'pearl-toggle-sort-order))))
+
(provide 'test-pearl-keymap)
;;; test-pearl-keymap.el ends here