From 41a33964c6b97858a17fd12288592b03d5df68d9 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 26 May 2026 14:24:44 -0500 Subject: feat(comments): lead the Comments heading with the 💬 glyph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Comments heading rendered the count marker as `Comments 💬 5/18`, with the glyph wedged between the word and the count. I moved the 💬 to the front of the heading, rendering `💬 Comments 5/18`, so it reads as an icon for the section rather than part of the number. `pearl--comment-count-marker` now returns just ` 5/18`, and `pearl--format-comments` leads with the glyph. The append locator that finds an issue's Comments subtree now tolerates the leading 💬, and still matches the old `Comments 💬 N/N` layout so a buffer rendered before this change keeps working on the next add-comment. --- pearl.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'pearl.el') diff --git a/pearl.el b/pearl.el index 30557a4..5d7423a 100644 --- a/pearl.el +++ b/pearl.el @@ -1763,11 +1763,12 @@ A null author renders as `(unknown)'." (if (string-empty-p body) "" (concat body "\n"))))) (defun pearl--comment-count-marker (count-info) - "Render COUNT-INFO as a ` 💬 shown/total[+]' suffix, or the empty string. + "Render COUNT-INFO as a ` shown/total[+]' suffix, or the empty string. COUNT-INFO is a plist (:shown N :total M :overflow BOOL) set on the bulk-list -path; nil (the single-issue thread) yields no marker." +path; nil (the single-issue thread) yields no marker. The 💬 glyph leads the +`Comments' heading itself (see `pearl--format-comments'), not this count." (if count-info - (format " 💬 %d/%d%s" + (format " %d/%d%s" (plist-get count-info :shown) (plist-get count-info :total) (if (plist-get count-info :overflow) "+" "")) @@ -1787,8 +1788,9 @@ newest, like an email thread, and a new comment appends at the bottom." Comments render under a level-3 `Comments' heading, ordered per `pearl-comment-sort-order'. Returns the empty string when COMMENTS is nil, so an issue with no comments -renders no subtree. COUNT-INFO, when non-nil, adds a `💬 shown/total' marker to -the heading (the bulk list passes the issue's `:comment-count')." +renders no subtree. The heading leads with a 💬 glyph; COUNT-INFO, when non-nil, +appends a ` shown/total' count (the bulk list passes the issue's +`:comment-count')." (if (null comments) "" (let* ((newest-first (eq pearl-comment-sort-order 'newest-first)) @@ -1797,7 +1799,7 @@ the heading (the bulk list passes the issue's `:comment-count')." (let ((ca (or (plist-get a :created-at) "")) (cb (or (plist-get b :created-at) ""))) (if newest-first (string> ca cb) (string< ca cb))))))) - (concat "*** Comments" (pearl--comment-count-marker count-info) "\n" + (concat "*** 💬 Comments" (pearl--comment-count-marker count-info) "\n" (mapconcat #'pearl--format-comment sorted ""))))) (defun pearl--format-issue-as-org-entry (issue) @@ -2481,8 +2483,9 @@ subtree at the end of the issue when it does not exist yet." (let* ((issue-end (save-excursion (org-end-of-subtree t t) (point))) (comments-pos (save-excursion - ;; tolerate a trailing "💬 shown/total" marker on the heading - (when (re-search-forward "^\\*+ Comments\\(?:[ \t].*\\)?$" issue-end t) + ;; tolerate the leading 💬 glyph and a trailing count marker; also + ;; match the pre-2026-05 "Comments 💬 N/N" layout in older files + (when (re-search-forward "^\\*+ \\(?:💬 \\)?Comments\\(?:[ \t].*\\)?$" issue-end t) (match-beginning 0))))) (if comments-pos (progn -- cgit v1.2.3