aboutsummaryrefslogtreecommitdiff
path: root/pearl.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 20:10:42 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 20:10:42 -0500
commitcfc42c41426d61f53c49b1f192751bcd061e57ae (patch)
tree0091739c4f499c5a6a849f6241139479a23f14f0 /pearl.el
parent34c67ddc3b72f92033ced3f86346f3483f5ba463 (diff)
downloadpearl-cfc42c41426d61f53c49b1f192751bcd061e57ae.tar.gz
pearl-cfc42c41426d61f53c49b1f192751bcd061e57ae.zip
fix(commands): run add-comment and delete from anywhere in a ticket
pearl-add-comment and pearl-delete-current-issue guarded position with the nearest-heading check, so from inside a comment subtree, or any heading without a LINEAR-ID, they errored "Not on a Linear issue heading". Both docstrings already claimed they work from anywhere in the subtree, so the behavior was just wrong. The edit and save commands already climb to the issue via pearl--goto-issue-heading-or-error. I switched these two to the same guard, so every ticket-scoped command resolves the enclosing issue from anywhere in its subtree, including from inside a comment. The redundant LINEAR-ID re-checks are gone since the guard guarantees it. Walk-up tests added for both.
Diffstat (limited to 'pearl.el')
-rw-r--r--pearl.el10
1 files changed, 2 insertions, 8 deletions
diff --git a/pearl.el b/pearl.el
index b0b3419..5dd55a7 100644
--- a/pearl.el
+++ b/pearl.el
@@ -2527,11 +2527,9 @@ non-interactively, is sent as-is. Works from anywhere inside an issue subtree;
the new comment is the viewer's own, so it renders editable."
(interactive (list nil))
(save-excursion
- (pearl--goto-heading-or-error)
+ (pearl--goto-issue-heading-or-error)
(let ((issue-id (org-entry-get nil "LINEAR-ID"))
(marker (point-marker)))
- (unless issue-id
- (user-error "Not on a Linear issue heading"))
(if body
(pearl--create-and-append-comment issue-id marker body)
(pearl--compose-in-buffer
@@ -2599,13 +2597,9 @@ Works from anywhere inside an issue subtree. Confirms first, then issues a
soft delete (Linear moves the issue to Trash, recoverable for about 30 days);
on success the issue's Org subtree is removed from the buffer."
(interactive)
- (unless (save-excursion (ignore-errors (org-back-to-heading t) t))
- (user-error "Not on a Linear issue heading"))
- (let* ((marker (save-excursion (org-back-to-heading t) (point-marker)))
+ (let* ((marker (save-excursion (pearl--goto-issue-heading-or-error) (point-marker)))
(issue-id (org-entry-get marker "LINEAR-ID"))
(ident (or (org-entry-get marker "LINEAR-IDENTIFIER") "this issue")))
- (unless issue-id
- (user-error "Not on a Linear issue heading"))
(when (yes-or-no-p (format "Delete %s from Linear (moves it to Trash)? " ident))
(pearl--delete-issue-async
issue-id