aboutsummaryrefslogtreecommitdiff
path: root/pearl.el
diff options
context:
space:
mode:
Diffstat (limited to 'pearl.el')
-rw-r--r--pearl.el32
1 files changed, 20 insertions, 12 deletions
diff --git a/pearl.el b/pearl.el
index 8adca82..8b4ebc7 100644
--- a/pearl.el
+++ b/pearl.el
@@ -2418,13 +2418,18 @@ proceeds and the subtree is replaced with Linear's version."
(message "Issue %s is no longer on Linear (deleted or no access); not refreshing"
issue-id))
(raw
- (save-excursion
- (goto-char marker)
- (pearl--replace-issue-subtree-at-point
- (pearl--normalize-issue raw)))
- (pearl-highlight-comments)
- (pearl--surface-buffer (marker-buffer marker))
- (message "Refreshed %s from Linear" issue-id)))))))))
+ ;; The fetch may complete after the buffer was killed; only
+ ;; rewrite it when it's still live.
+ (if (buffer-live-p (marker-buffer marker))
+ (progn
+ (save-excursion
+ (goto-char marker)
+ (pearl--replace-issue-subtree-at-point
+ (pearl--normalize-issue raw)))
+ (pearl-highlight-comments)
+ (pearl--surface-buffer (marker-buffer marker))
+ (message "Refreshed %s from Linear" issue-id))
+ (message "Refreshed %s; its buffer was closed" issue-id))))))))))
(defun pearl--create-comment-async (issue-id body callback)
"Create a comment with BODY on ISSUE-ID via commentCreate.
@@ -2657,12 +2662,15 @@ tail of the field-setter commands (priority/state/assignee/labels)."
issue-id fields
(lambda (result)
(if (plist-get result :success)
+ ;; The push may complete after the buffer was killed; only touch it
+ ;; when it's still live, but still report the (remote) success.
(progn
- (save-excursion
- (goto-char marker)
- (funcall on-success))
- (message "%s" success-message)
- (pearl--surface-buffer (marker-buffer marker)))
+ (when (buffer-live-p (marker-buffer marker))
+ (save-excursion
+ (goto-char marker)
+ (funcall on-success))
+ (pearl--surface-buffer (marker-buffer marker)))
+ (message "%s" success-message))
(message "%s" fail-message)))))
(defun pearl-set-priority (priority-name)