diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-25 01:25:43 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-25 01:25:43 -0500 |
| commit | 619d4ce0294ff318a96e2f82a8f9401111bb619d (patch) | |
| tree | 09afcbe17151ed3dda5a2043fd6625264611146c /pearl.el | |
| parent | 56511a51afc66bc7efebee657bf040624defde65 (diff) | |
| download | pearl-619d4ce0294ff318a96e2f82a8f9401111bb619d.tar.gz pearl-619d4ce0294ff318a96e2f82a8f9401111bb619d.zip | |
feat: add the pearl-prefix-map keymap and regroup the transient menu
The command surface had no muscle-memory path. Everything went through M-x or the transient, and the transient grouped commands by an ad-hoc mix (issue-at-point, create, org-sync) rather than by what you're doing.
I added pearl-prefix-map, an opt-in prefix keymap organized as save / edit / new / delete. It isn't bound at load, because a global multi-key prefix isn't reliably free across terminals and GUIs. Each binding is a (label . command) menu item, so which-key shows the label without pearl depending on which-key. The user binds the map to a free prefix (the README suggests C-; L). So C-; L s s saves the ticket at point, s a saves the whole file, e p edits priority, n t creates a ticket, m opens the transient.
I regrouped the transient to mirror those categories: Save, Edit, New, Delete for ticket actions, and Fetch, View, Setup for the workspace. I added the two save commands and relabeled every entry to the verb wording. The per-field push entries (edit-desc, edit-title) are gone since the save model subsumes them, though the commands still work from M-x. I pulled the org-sync commands (enable, disable, push-file) from the menu too, since they're plumbing, tracked separately for going private.
The keymap binds the existing command names. Aligning those names with the labels (edit-state, new-comment) is a separate task, as is the delete-comment command that will fill the d c slot.
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 126 |
1 files changed, 96 insertions, 30 deletions
@@ -4140,39 +4140,105 @@ reported (refresh to reconcile)." ;;;###autoload (autoload 'pearl-menu "pearl" nil t) (transient-define-prefix pearl-menu () "Dispatch menu for pearl commands." - ["Linear" + ;; Grouped to mirror the `pearl-prefix-map' categories (save / edit / new / + ;; delete); fetch / view / setup are the operational groups with no keymap + ;; equivalent. The org-sync commands (enable / disable / push-file) are + ;; deliberately not surfaced -- they are plumbing (see the todo). + ["Ticket" + ["Save" + ("e" "save ticket" pearl-save-issue) + ("E" "save all" pearl-save-all)] + ["Edit" + ("D" "edit description" pearl-compose-current-description) + ("M" "edit comment" pearl-edit-current-comment) + ("P" "edit priority" pearl-set-priority) + ("s" "edit state" pearl-set-state) + ("a" "edit assignee" pearl-set-assignee) + ("L" "edit labels" pearl-set-labels)] + ["New" + ("n" "new ticket" pearl-new-issue) + ("c" "new comment" pearl-add-comment)] + ["Delete" + ("k" "delete ticket" pearl-delete-current-issue)]] + ["Workspace" ["Fetch" - ("l" "My open issues" pearl-list-issues) - ("p" "By project" pearl-list-issues-by-project) - ("f" "Build a filter" pearl-list-issues-filtered) - ("v" "Custom view" pearl-run-view) - ("Q" "Saved query" pearl-run-saved-query)] + ("l" "my open issues" pearl-list-issues) + ("p" "by project" pearl-list-issues-by-project) + ("f" "build a filter" pearl-list-issues-filtered) + ("v" "custom view" pearl-run-view) + ("Q" "saved query" pearl-run-saved-query)] ["View" - ("g" "Refresh view" pearl-refresh-current-view) - ("r" "Refresh issue" pearl-refresh-current-issue) - ("b" "Open view in Linear" pearl-open-current-view-in-linear)] - ["Issue at point" - ("e" "Edit desc -> push" pearl-sync-current-issue) - ("D" "Compose desc -> push" pearl-compose-current-description) - ("t" "Edit title -> push" pearl-sync-current-issue-title) - ("s" "Set state" pearl-set-state) - ("a" "Set assignee" pearl-set-assignee) - ("P" "Set priority" pearl-set-priority) - ("L" "Set labels" pearl-set-labels) - ("c" "Add comment" pearl-add-comment) - ("M" "Edit comment" pearl-edit-current-comment) - ("k" "Delete issue" pearl-delete-current-issue) - ("o" "Open in browser" pearl-open-current-issue)] - ["Create & org-sync" - ("n" "New issue" pearl-new-issue) - ("E" "Enable org-sync" pearl-enable-org-sync) - ("X" "Disable org-sync" pearl-disable-org-sync) - ("u" "Push file -> Linear" pearl-sync-org-to-linear)] + ("g" "refresh view" pearl-refresh-current-view) + ("r" "refresh issue" pearl-refresh-current-issue) + ("b" "open view in Linear" pearl-open-current-view-in-linear) + ("o" "open ticket in browser" pearl-open-current-issue)] ["Setup" - ("T" "Test connection" pearl-test-connection) - ("C" "Check setup" pearl-check-setup) - ("!" "Toggle debug" pearl-toggle-debug) - ("x" "Clear cache" pearl-clear-cache)]]) + ("T" "test connection" pearl-test-connection) + ("C" "check setup" pearl-check-setup) + ("!" "toggle debug" pearl-toggle-debug) + ("x" "clear cache" pearl-clear-cache)]]) + +;;; Prefix Keymap +;; +;; An opt-in prefix keymap organizing the commands under save / edit / new / +;; delete sub-maps. It is defined but NOT bound at load -- a global prefix +;; isn't reliably free across terminals and GUIs, and auto-installing one is a +;; compatibility call the user should own. Bind it to a free prefix, e.g. +;; +;; (global-set-key (kbd "C-; L") pearl-prefix-map) +;; ;; or, with use-package: :bind-keymap ("C-; L" . pearl-prefix-map) +;; +;; Each binding is a (LABEL . COMMAND) menu item, so `which-key' shows the +;; verb-matched label (e.g. "edit priority") without pearl depending on +;; which-key. Lookups still resolve straight to the command. +;; +;; The labels follow the edit/new verbs even though some commands keep older +;; names (`pearl-compose-current-description', `pearl-set-state', and +;; `pearl-add-comment'); aligning the command names is a separate task. The +;; `d c' delete-comment slot is intentionally empty until that command exists. + +(defvar pearl-save-map + (let ((map (make-sparse-keymap))) + (define-key map "s" (cons "save ticket" #'pearl-save-issue)) + (define-key map "a" (cons "save all" #'pearl-save-all)) + map) + "Pearl save commands; a sub-keymap of `pearl-prefix-map'.") + +(defvar pearl-edit-map + (let ((map (make-sparse-keymap))) + (define-key map "d" (cons "edit description" #'pearl-compose-current-description)) + (define-key map "c" (cons "edit comment" #'pearl-edit-current-comment)) + (define-key map "p" (cons "edit priority" #'pearl-set-priority)) + (define-key map "s" (cons "edit state" #'pearl-set-state)) + (define-key map "a" (cons "edit assignee" #'pearl-set-assignee)) + (define-key map "l" (cons "edit labels" #'pearl-set-labels)) + map) + "Pearl edit commands; a sub-keymap of `pearl-prefix-map'.") + +(defvar pearl-new-map + (let ((map (make-sparse-keymap))) + (define-key map "t" (cons "new ticket" #'pearl-new-issue)) + (define-key map "c" (cons "new comment" #'pearl-add-comment)) + map) + "Pearl new-object commands; a sub-keymap of `pearl-prefix-map'.") + +(defvar pearl-delete-map + (let ((map (make-sparse-keymap))) + (define-key map "t" (cons "delete ticket" #'pearl-delete-current-issue)) + map) + "Pearl delete commands; a sub-keymap of `pearl-prefix-map'.") + +(defvar pearl-prefix-map + (let ((map (make-sparse-keymap))) + (define-key map "s" (cons "+save" pearl-save-map)) + (define-key map "e" (cons "+edit" pearl-edit-map)) + (define-key map "n" (cons "+new" pearl-new-map)) + (define-key map "d" (cons "+delete" pearl-delete-map)) + (define-key map "m" (cons "menu" #'pearl-menu)) + map) + "Opt-in Pearl command prefix keymap. +Not bound at load. Bind it to a free prefix, such as the suggested +\\=`C-; L\\=', in your own configuration (see the Commentary above).") (provide 'pearl) ;;; pearl.el ends here
\ No newline at end of file |
