From b1df299c164bd688ce4d0887603e6b71ea51bd22 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 28 May 2026 10:32:25 -0500 Subject: refactor(render): drop the leading 💬 glyph from the Comments heading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pearl was rendering the Comments subtree heading as `*** 💬 Comments [N/M]`. Craig flagged that it looks strange, and the renderer should work cleanly before it gets glyphed. I dropped the emoji prefix so the heading reads `*** Comments [N/M]`. Partly reverts 41a3396. The overlay-glyph idea (a content-aware display overlay on the leading stars) stays tracked as a separate task. I touched pearl--format-comments (the new-subtree literal) and pearl--append-comment-to-issue (both the new-subtree insert and a couple of stale docstring references). The append-locator regex stays tolerant of the legacy `💬 Comments` heading and of the older pre-2026-05 `Comments 💬 N/N` trailing-glyph layout. Buffers rendered in any of the three states still locate their Comments heading on append. I added one regression test (test-pearl-append-comment-locates-legacy-emoji-prefixed-heading) that seeds a `*** 💬 Comments 1/1` heading and asserts append still finds it, bumps the count to 2/2, and doesn't add a second Comments heading. I updated assertions in test-pearl-comments.el, test-pearl-list-comments.el, and test-integration-acceptance.el to expect the no-emoji form. I also updated docstrings on pearl-fetch-comments-in-list, pearl-list-comments-count-cap, pearl--format-comments, pearl--bump-comments-count-marker, and pearl--comment-count-marker. The README's sample buffer block now matches what the renderer emits. All 669 ert tests pass. make compile and make lint are clean. --- pearl.el | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'pearl.el') diff --git a/pearl.el b/pearl.el index a8192b9..00271f9 100644 --- a/pearl.el +++ b/pearl.el @@ -982,7 +982,7 @@ is the already-extracted (normalized) list, so this stays pure." (defcustom pearl-fetch-comments-in-list t "When non-nil, the bulk list and Custom View fetch each issue's recent comments. A populated list then renders the latest few comments per issue with a -`💬 shown/total' marker on the Comments heading, instead of looking like +`shown/total' marker on the Comments heading, instead of looking like nothing has comments. Set to nil to keep the list fetch light (comments load only on a single-issue refresh)." :type 'boolean @@ -998,7 +998,7 @@ list/view view. See `pearl-fetch-comments-in-list'." (defcustom pearl-list-comments-count-cap 25 "Ceiling for the exact comment total shown in the bulk list marker. The fetch pulls one more than this so the marker can show an exact total up to -the cap (`💬 5/18') and a `+' beyond it (`💬 5/25+'). A higher cap means an +the cap (`5/18') and a `+' beyond it (`5/25+'). A higher cap means an exact count for busier issues at the cost of a larger fetch." :type 'integer :group 'pearl) @@ -2002,8 +2002,8 @@ A null author renders as `(unknown)'." (defun pearl--comment-count-marker (count-info) "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. The 💬 glyph leads the -`Comments' heading itself (see `pearl--format-comments'), not this count." +path; nil (the single-issue thread) yields no marker. The marker appends +to the `Comments' heading written by `pearl--format-comments'." (if count-info (format " %d/%d%s" (plist-get count-info :shown) @@ -2025,9 +2025,8 @@ 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. 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')." +renders no subtree. COUNT-INFO, when non-nil, appends a ` shown/total' +count to the heading (the bulk list passes the issue's `:comment-count')." (if (null comments) "" (let* ((newest-first (eq pearl-comment-sort-order 'newest-first)) @@ -2036,7 +2035,7 @@ appends a ` shown/total' count (the bulk list passes the issue's (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) @@ -2714,8 +2713,7 @@ GraphQL/transport failure or a non-success payload." (defun pearl--bump-comments-count-marker () "Increment the ` N/M[+]' count on the Comments heading at point, if present. A locally added comment grows both the shown and total counts by one. A heading -that carries no count marker (the single-issue view) is left untouched, and the -leading 💬 glyph is preserved either way." +that carries no count marker (the single-issue view) is left untouched." (save-excursion (let ((eol (line-end-position))) (beginning-of-line) @@ -2737,8 +2735,11 @@ 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 the leading 💬 glyph and a trailing count marker; also - ;; match the pre-2026-05 "Comments 💬 N/N" layout in older files + ;; Match the new no-emoji form, the prior `💬 ' leading-glyph + ;; layout (rendered between 2026-05-26 and the de-emoji + ;; revert), and the pre-2026-05 trailing-glyph layout + ;; (`Comments 💬 N/N'). Buffers rendered in any of the three + ;; states locate their Comments heading. (when (re-search-forward "^\\*+ \\(?:💬 \\)?Comments\\(?:[ \t].*\\)?$" issue-end t) (match-beginning 0))))) (if comments-pos @@ -2756,7 +2757,7 @@ subtree at the end of the issue when it does not exist yet." ;; no Comments subtree yet: this is the first comment, so it is 1/1 (goto-char issue-end) (let ((start (point))) - (insert "*** 💬 Comments 1/1\n" (pearl--format-comment comment)) + (insert "*** Comments 1/1\n" (pearl--format-comment comment)) (pearl--hide-drawers-in-region start (point))))))) ;;;###autoload -- cgit v1.2.3