aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-06 18:33:10 -0500
committerCraig Jennings <c@cjennings.net>2026-06-06 18:33:10 -0500
commit4a4b1bc974a3fdb4d88af3ee575786ca363696e2 (patch)
tree8913c45562c56069856b57d2fc46e1f4f19e8881
parent7bd9f49ed7cb8482226d70ffaaa3d83fde194710 (diff)
downloadpearl-4a4b1bc974a3fdb4d88af3ee575786ca363696e2.tar.gz
pearl-4a4b1bc974a3fdb4d88af3ee575786ca363696e2.zip
feat(render): name the active account in the buffer title
With two workspaces, the preamble summary read "Pearl - <view> ..." for both, so you couldn't tell from the title which account a buffer belonged to. It now reads "Pearl - <account> - <view> · <count> · <time>", pulling the account from the buffer's #+LINEAR-ACCOUNT. A legacy buffer with no account stamp drops the segment and reads as before.
-rw-r--r--pearl.el14
-rw-r--r--tests/test-pearl-output.el13
2 files changed, 23 insertions, 4 deletions
diff --git a/pearl.el b/pearl.el
index 4f85961..3f0a4ae 100644
--- a/pearl.el
+++ b/pearl.el
@@ -4234,15 +4234,21 @@ has no heading."
(defun pearl--preamble-summary ()
"Compose the one-line preamble summary for the current Linear buffer.
-\"Pearl - <view> · <count> · <time>\", read from `#+LINEAR-SOURCE' (its name),
-`#+LINEAR-COUNT', and the time portion of `#+LINEAR-RUN-AT'. Missing fields are
-omitted. Leads with \"Pearl\" so the line doubles as the buffer's identity."
+\"Pearl - <account> - <view> · <count> · <time>\", read from `#+LINEAR-ACCOUNT'
+(the active workspace), `#+LINEAR-SOURCE' (its name), `#+LINEAR-COUNT', and the
+time portion of `#+LINEAR-RUN-AT'. Missing fields are omitted; a buffer with no
+`#+LINEAR-ACCOUNT' (legacy single-account mode) drops the account segment.
+Leads with \"Pearl\" so the line doubles as the buffer's identity, and names the
+account so two workspaces' buffers read differently at a glance."
(let* ((src (pearl--read-active-source))
(name (or (and src (plist-get src :name)) "Linear"))
+ (account (pearl--read-buffer-account))
(count (pearl--preamble-keyword "LINEAR-COUNT"))
(runat (pearl--preamble-keyword "LINEAR-RUN-AT"))
(time (and runat (car (last (split-string runat))))))
- (concat "Pearl - " name
+ (concat "Pearl - "
+ (and account (format "%s - " account))
+ name
(and count (format " · %s" count))
(and time (format " · %s" time)))))
diff --git a/tests/test-pearl-output.el b/tests/test-pearl-output.el
index 1035ff2..66dc096 100644
--- a/tests/test-pearl-output.el
+++ b/tests/test-pearl-output.el
@@ -214,6 +214,19 @@ appear -- a minimal preamble of just the machine keywords."
(should (string-match-p " · 1" s)) ; one rendered issue
(should (string-match-p "·" s)))))
+(ert-deftest test-pearl-preamble-summary-names-the-account ()
+ "In accounts mode the summary names the active account after Pearl, so two
+buffers from different workspaces read differently."
+ (with-temp-buffer
+ (insert (pearl--build-org-content
+ '((:id "i1" :identifier "ENG-1" :title "one" :priority 1
+ :state (:name "In Progress") :team (:id "t1")))
+ '(:type filter :name "My open work" :filter (:assignee :me :open t))
+ nil nil "deepsat"))
+ (org-mode)
+ (goto-char (point-min))
+ (should (string-prefix-p "Pearl - deepsat - My open work" (pearl--preamble-summary)))))
+
(ert-deftest test-pearl-hide-preamble-lays-one-tagged-overlay ()
"With the option on, one tagged display overlay covers the preamble; applying
twice keeps exactly one (idempotent); off removes it. Buffer text is untouched."