From 37bf61d3674063c7c6f726adccb142fecbf7fe75 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 23 Mar 2023 09:37:42 +0100 Subject: separate faves/boosts-count prop in toot-stats this is so we can safely update the count display prop without touching the emoji --- lisp/mastodon-tl.el | 12 ++++++++---- lisp/mastodon-toot.el | 6 ++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index bf0bc7e..289eda1 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1131,23 +1131,27 @@ To disable showing the stats, customize (when-let ((toot (mastodon-tl--toot-for-stats toot))) (let* ((favourites-count (alist-get 'favourites_count toot)) (favourited (equal 't (alist-get 'favourited toot))) + (faves-prop (propertize (format "%s" favourites-count) + 'favourites-count favourites-count)) (boosts-count (alist-get 'reblogs_count toot)) (boosted (equal 't (alist-get 'reblogged toot))) + (boosts-prop (propertize (format "%s" boosts-count) + 'boosts-count boosts-count)) (replies-count (alist-get 'replies_count toot)) - (favourites (format "%s %s" favourites-count (mastodon-tl--symbol 'favourite))) - (boosts (format "%s %s" boosts-count (mastodon-tl--symbol 'boost))) + (favourites (format "%s %s" faves-prop ;favourites-count + (mastodon-tl--symbol 'favourite))) + (boosts (format "%s %s" boosts-prop ;boosts-count + (mastodon-tl--symbol 'boost))) (replies (format "%s %s" replies-count (mastodon-tl--symbol 'reply))) (status (concat (propertize favourites 'favourited-p favourited 'favourites-field t - 'favourites-count favourites-count 'face font-lock-comment-face) (propertize " | " 'face font-lock-comment-face) (propertize boosts 'boosted-p boosted 'boosts-field t - 'boosts-count boosts-count 'face font-lock-comment-face) (propertize " | " 'face font-lock-comment-face) (propertize replies diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 8183c27..82a9482 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -400,10 +400,8 @@ SUBTRACT means we are un-favouriting or unboosting, so we decrement." (car count-prop-range) (cdr count-prop-range) (list 'display ; update the display prop: - (concat - (number-to-string - (mastodon-toot--inc-or-dec count subtract)) - " ") + (number-to-string + (mastodon-toot--inc-or-dec count subtract)) ;; update the count prop ;; we rely on this for any subsequent actions: count-prop -- cgit v1.2.3