From cc599d3e9d37c200d49f723ff8e8ce694acd33f8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 24 May 2026 17:21:29 -0500 Subject: feat: make comment sort order configurable, newest-first by default I added pearl-comment-sort-order to choose how an issue's comments render under the Comments heading: newest-first (the default, most recent on top) or oldest-first (chronological, like an email thread). Both the render sort and the add-comment insertion point honor it, so a new comment lands at the top for newest-first and at the bottom for oldest-first. --- tests/test-pearl-list-comments.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tests/test-pearl-list-comments.el') diff --git a/tests/test-pearl-list-comments.el b/tests/test-pearl-list-comments.el index 630c712..be0880e 100644 --- a/tests/test-pearl-list-comments.el +++ b/tests/test-pearl-list-comments.el @@ -98,13 +98,14 @@ ;;; --format-comments with a marker -(ert-deftest test-pearl-format-comments-renders-marker-and-oldest-first () - "With count-info, the Comments heading carries the marker; bodies stay oldest-first." - (let* ((comments (test-pearl--comments 5)) ; newest-first as fetched +(ert-deftest test-pearl-format-comments-renders-marker-and-order () + "With count-info the Comments heading carries the marker; bodies honor the sort order." + (let* ((pearl-comment-sort-order 'newest-first) + (comments (test-pearl--comments 5)) ; newest-first as fetched (out (pearl--format-comments comments '(:shown 5 :total 12 :overflow nil)))) (should (string-match-p "^\\*\\*\\* Comments 💬 5/12$" out)) - ;; oldest (comment 1) renders before newest (comment 5) - (should (< (string-match "comment 1\\b" out) (string-match "comment 5\\b" out))))) + ;; newest (comment 5) renders before oldest (comment 1) + (should (< (string-match "comment 5\\b" out) (string-match "comment 1\\b" out))))) (ert-deftest test-pearl-format-comments-no-marker-without-count () "Without count-info (the single-issue thread), the heading has no marker." -- cgit v1.2.3