diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-26 14:24:44 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-26 14:24:44 -0500 |
| commit | 41a33964c6b97858a17fd12288592b03d5df68d9 (patch) | |
| tree | e3fd3917cc82197c80e6d0267c59ee155a670651 /pearl.el | |
| parent | 052aef8689af897c20e02d069fcdb09490996d2d (diff) | |
| download | pearl-41a33964c6b97858a17fd12288592b03d5df68d9.tar.gz pearl-41a33964c6b97858a17fd12288592b03d5df68d9.zip | |
feat(comments): lead the Comments heading with the 💬 glyph
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.
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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 |
