From ca8d6676dab2ace4812d9d6ccc2f592eac8bc23f Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 9 May 2023 09:25:33 +0200 Subject: let-alist for tl--toot-stats --- lisp/mastodon-tl.el | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 9618cfe..82b037f 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1323,38 +1323,31 @@ When the TOOT is a reblog (boost), statistics from reblogged toots are returned. To disable showing the stats, customize `mastodon-tl--show-stats'." - (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" 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))) + (let-alist (mastodon-tl--toot-for-stats toot) + (let* ((faves-prop (propertize (format "%s" .favourites_count) + 'favourites-count .favourites_count)) + (boosts-prop (propertize (format "%s" .reblogs_count) + 'boosts-count .reblogs_count)) + (faves (format "%s %s" faves-prop (mastodon-tl--symbol 'favourite))) + (boosts (format "%s %s" boosts-prop (mastodon-tl--symbol 'boost))) + (replies (format "%s %s" .replies_count (mastodon-tl--symbol 'reply))) (status (concat - (propertize favourites - 'favourited-p favourited + (propertize faves + 'favourited-p (eq 't .favourited) 'favourites-field t - 'help-echo (format "%s favourites" favourites-count) + 'help-echo (format "%s favourites" .favourites_count) 'face font-lock-comment-face) (propertize " | " 'face font-lock-comment-face) (propertize boosts - 'boosted-p boosted + 'boosted-p (eq 't .reblogged) 'boosts-field t - 'help-echo (format "%s boosts" boosts-count) + 'help-echo (format "%s boosts" .reblogs_count) 'face font-lock-comment-face) (propertize " | " 'face font-lock-comment-face) (propertize replies 'replies-field t - 'replies-count replies-count - 'help-echo (format "%s replies" replies-count) + 'replies-count .replies_count + 'help-echo (format "%s replies" .replies_count) 'face font-lock-comment-face))) (status (concat -- cgit v1.2.3