diff options
author | mousebot <mousebot@riseup.net> | 2021-05-16 13:05:26 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-05-16 13:18:19 +0200 |
commit | e1269b9fbf87013a9909cfced340fa47f43dc33a (patch) | |
tree | a702894fb21469b49bf5f56f7296e5e317740f3f | |
parent | 508e3faeceb03ad14bb350d0da56552edf33ccc2 (diff) |
display pinned toots first on a user's profile.
also: profile--relationships-get no longer interactive.
and docstrings for fields insert.
indent "pinned" for pinned toots display
-rw-r--r-- | lisp/mastodon-profile.el | 7 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 20 |
2 files changed, 20 insertions, 7 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index ec3dd0f..11ad02e 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -101,8 +101,7 @@ following the current profile." (error "Not in a mastodon profile"))) (defun mastodon-profile--relationships-get (id) - "Fetch info about logged in user's relationship to user with id ID." - (interactive) + "Fetch info about logged-in user's relationship to user with id ID." (let* ((their-id id) (url (mastodon-http--api (format "accounts/relationships?id[]=%s" @@ -110,7 +109,7 @@ following the current profile." (mastodon-http--get-json url))) (defun mastodon-profile--fields-get (account) - "Fetch the fields vector from a profile. + "Fetch the fields vector (a.k.a profile metadata) from a profile. Returns a list of lists." (let ((fields (mastodon-profile--account-field account 'fields))) @@ -123,7 +122,7 @@ Returns a list of lists." fields)))) (defun mastodon-profile--fields-insert (fields) - "Format and insert field pairs in FIELDS." + "Format and insert field pairs (a.k.a profile metadata) in FIELDS." (let* ((car-fields (mapcar 'car fields)) ;; (cdr-fields (mapcar 'cadr fields)) ;; (cdr-fields-rendered diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 7624088..8ac9d9c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -673,9 +673,23 @@ it is `mastodon-tl--byline-boosted'" 'mastodon-tl--byline-boosted)) (defun mastodon-tl--timeline (toots) - "Display each toot in TOOTS." - (mapc 'mastodon-tl--toot toots) - (goto-char (point-min))) + "Display each toot in TOOTS. + +If any toots are pinned, display them first." + (let* ((pinned-list)) + (mapcar (lambda (toot) + (when (equal (cdr (assoc 'pinned toot)) 't) + (push toot pinned-list))) + toots) + (when pinned-list + (progn + (insert (mastodon-tl--set-face + " :pinned: " 'success)) + (mapc 'mastodon-tl--toot pinned-list) + (insert (mastodon-tl--set-face + " :end-pinned: \n" 'success)))) + (mapc 'mastodon-tl--toot toots) + (goto-char (point-min)))) (defun mastodon-tl--get-update-function (&optional buffer) "Get the UPDATE-FUNCTION stored in `mastodon-tl--buffer-spec'" |