From 877c104bfa8497324de45b2fef96dd4520da07e4 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 5 Jun 2026 02:08:43 -0500 Subject: fix(render): serialize the source header in full regardless of print-length The #+LINEAR-SOURCE descriptor was written with a bare prin1-to-string, which honors the user's print-length and print-level. A long source, like a Custom View's (it carries a sort vector, a url, and several keys), truncated to "..." for anyone whose config caps those (mine sits at 10). The header then read back as a malformed, odd-length plist, so refresh and the new sort commands errored on the view. A short source like my-open-issues fit under the cap and hid the bug. pearl--linear-source-string binds both to nil around the serialization, and the two header writers (the full render and the sort header rewrite) go through it. I caught it dogfooding the interactive sort live on a real view. --- pearl.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'pearl.el') diff --git a/pearl.el b/pearl.el index 1cf4b53..a24d7dd 100644 --- a/pearl.el +++ b/pearl.el @@ -4187,6 +4187,15 @@ merge rewrites keep working." (propertize (concat (pearl--preamble-summary) "\n") 'face 'pearl-preamble-summary)))))))) +(defun pearl--linear-source-string (source) + "Serialize SOURCE for the `#+LINEAR-SOURCE:' header, in full. +Binds `print-length' and `print-level' to nil so a long source (a view's +descriptor carries a sort vector, url, and several keys) never truncates to +`...' under a user's global print settings -- a truncated descriptor reads back +as a malformed plist and breaks refresh and sort." + (let ((print-length nil) (print-level nil)) + (prin1-to-string source))) + (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 @@ -4219,7 +4228,7 @@ no side effects." ;; rest is human-readable provenance. (when account (insert (format "#+LINEAR-ACCOUNT: %s\n" account))) - (insert (format "#+LINEAR-SOURCE: %s\n" (prin1-to-string src))) + (insert (format "#+LINEAR-SOURCE: %s\n" (pearl--linear-source-string src))) (insert (format "#+LINEAR-RUN-AT: %s\n" (format-time-string "%Y-%m-%d %H:%M"))) (insert (format "#+LINEAR-FILTER: %s\n" (pearl--summarize-filter filter))) (insert (format "#+LINEAR-COUNT: %d\n" (length issues))) @@ -6782,7 +6791,7 @@ count/timestamp provenance and leaves the descriptor alone." (save-excursion (goto-char (point-min)) (when (re-search-forward "^#\\+LINEAR-SOURCE: .*$" nil t) - (replace-match (format "#+LINEAR-SOURCE: %s" (prin1-to-string source)) t t)))) + (replace-match (format "#+LINEAR-SOURCE: %s" (pearl--linear-source-string source)) t t)))) (defun pearl--active-source-or-error () "Return the active source descriptor, or signal a `user-error' if absent." -- cgit v1.2.3