diff options
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -3529,6 +3529,8 @@ proceeds and the subtree is replaced with Linear's version." (pearl--replace-issue-subtree-at-point (pearl--normalize-issue raw))) (pearl-highlight-comments) + (with-current-buffer (marker-buffer marker) + (pearl--save-if-visiting)) (pearl--surface-buffer (marker-buffer marker)) (message "Refreshed %s from Linear" issue-id)) (message "Refreshed %s; its buffer was closed" issue-id)))))))))) @@ -3627,7 +3629,8 @@ create callback fires with another buffer current (the compose path)." (save-excursion (goto-char marker) (pearl--append-comment-to-issue comment)) - (pearl-highlight-comments)) + (pearl-highlight-comments) + (pearl--save-if-visiting)) (pearl--surface-buffer buf))) (message "Added comment to %s" issue-id))))) @@ -3729,7 +3732,8 @@ those first." (save-excursion (goto-char marker) (pearl--replace-comments-subtree comments)) - (pearl-highlight-comments)) + (pearl-highlight-comments) + (pearl--save-if-visiting)) (pearl--surface-buffer buf) (message "Fetched all %d comment%s for %s" (length comments) @@ -4196,6 +4200,15 @@ as a malformed plist and breaks refresh and sort." (let ((print-length nil) (print-level nil)) (prin1-to-string source))) +(defun pearl--save-if-visiting () + "Save the current buffer to its file when it visits one. +A no-op in a non-file buffer. A fetch/refresh renders Linear's data into the +file-backed Pearl buffer; saving keeps the file in step with what's on screen, +the way the full-replace render already does. Saving the Org file never pushes +to Linear -- a local edit still needs `pearl-save-issue' -- so this only syncs +the disk copy." + (when buffer-file-name (save-buffer))) + (defun pearl--build-org-content (issues &optional source truncated states account) "Build the Org content string for the linear org file from ISSUES. SOURCE is the active-source descriptor recorded in the header so a later @@ -4359,6 +4372,7 @@ just writing the file and leaving it off-screen." ;; edit-then-merge flow doesn't collapse the subtree they were ;; editing. (pearl--fold-touched-subtrees (plist-get counts :touched-markers)) + (pearl--save-if-visiting) (message "Merged into %s: %d updated, %d added, %d dropped%s" (file-name-nondirectory org-file-path) (plist-get counts :updated) @@ -6733,6 +6747,7 @@ of the replace path." ;; Same as the dirty-merge path: fold only the touched subtrees, leave ;; the rest of the page and point alone. (pearl--fold-touched-subtrees (plist-get counts :touched-markers)) + (pearl--save-if-visiting) (pearl--surface-buffer (current-buffer)) (message "Refreshed %s: %d updated, %d added, %d dropped%s" (pearl--source-name source) |
