aboutsummaryrefslogtreecommitdiff
path: root/pearl.el
diff options
context:
space:
mode:
Diffstat (limited to 'pearl.el')
-rw-r--r--pearl.el49
1 files changed, 49 insertions, 0 deletions
diff --git a/pearl.el b/pearl.el
index 799a195..a352fd1 100644
--- a/pearl.el
+++ b/pearl.el
@@ -112,6 +112,8 @@ per-workspace settings:
(:env \"VAR\"), or (:literal \"lin_...\").
:org-file the account's active org file (`~' is expanded).
:default-team-id default team for new issues; optional.
+ :default-view local-view name `pearl-open-default-view' opens for this
+ account, or nil for my open issues; optional.
:url GraphQL endpoint; optional, defaults to
`pearl-graphql-url'.
@@ -448,6 +450,7 @@ to `pearl-graphql-url'. Errors when NAME is unknown or its key is missing."
(plist-get spec :api-key-source) name)
:org-file (and org-file (expand-file-name org-file))
:default-team-id (plist-get spec :default-team-id)
+ :default-view (plist-get spec :default-view)
:url (or (plist-get spec :url) pearl-graphql-url)))))
(defun pearl--current-account-context ()
@@ -3764,6 +3767,21 @@ Linear Custom View for OR logic."
:type '(alist :key-type string :value-type plist)
:group 'pearl)
+(defcustom pearl-default-view nil
+ "Local view `pearl-open-default-view' opens, or nil for my open issues.
+A durable preference for what the hot key shows. nil means the built-in
+\"my open issues\" fetch (`pearl-list-issues' with no project -- today's
+behavior); a string names a local view in `pearl-local-views'.
+
+In multi-account mode the active account's `:default-view' key (see
+`pearl-accounts') takes precedence and this global is unused; it applies in
+legacy single-account mode. To default to a Linear Custom View, save it
+locally first with `pearl-save-linear-view-locally' and name the resulting
+local view here. Set it durably through `pearl-set-default-view'."
+ :type '(choice (const :tag "My open issues" nil)
+ (string :tag "Local view name"))
+ :group 'pearl)
+
(defun pearl--sort-issues (issues sort order)
"Return ISSUES sorted by SORT (a symbol) in ORDER (`asc' or `desc').
SORT is one of `updated', `priority', `title', or nil (no client-side sort).
@@ -6133,6 +6151,37 @@ how each issue's state renders as a TODO keyword."
filter
(lambda (result) (pearl--render-query-result result source)))))
+(defun pearl--resolve-default-view ()
+ "Return the active scope's default view: a local-view name string, or nil.
+In accounts mode the active account's `:default-view'; in legacy
+single-account mode the global `pearl-default-view'. nil means \"my open
+issues\". Resolving the account context follows the same active/default
+fallback every account-aware command uses."
+ (let ((ctx (pearl--current-account-context)))
+ (if ctx
+ (plist-get ctx :default-view)
+ pearl-default-view)))
+
+;;;###autoload
+(defun pearl-open-default-view ()
+ "Open the configured default view, or my open issues when none is set.
+Resolves the active scope's default (`pearl--resolve-default-view'): nil runs
+`pearl-list-issues' (my open issues); a local-view name in `pearl-local-views'
+runs `pearl-run-local-view'; a name no longer present falls back to
+`pearl-list-issues' with a message rather than erroring -- a stale default
+never blocks the hot key."
+ (interactive)
+ (let ((default (pearl--resolve-default-view)))
+ (cond
+ ((null default)
+ (pearl-list-issues))
+ ((assoc default pearl-local-views)
+ (pearl-run-local-view default))
+ (t
+ (message "Default view '%s' no longer exists; showing my open issues"
+ default)
+ (pearl-list-issues)))))
+
;;;###autoload
(defun pearl-list-issues-by-project ()
"List every open Linear issue in a chosen project (all assignees).