diff options
author | mousebot <mousebot@riseup.net> | 2022-02-07 16:54:54 +0100 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2022-02-07 16:58:12 +0100 |
commit | 4bd42aa4c52d709a512be94524fe1182eac9c4f6 (patch) | |
tree | 4b2ba033d489da28c2f74f215d328cc7edd29dc9 /lisp/mastodon-search.el | |
parent | 7e21eeabc68102e4bae6c5729a69daf5b9e2aca4 (diff) |
implement follow suggestions.
this factors out display of accounts from mastodon-search--search-query into
mastodon-search--insert-users-propertized.
mastodon-tl--get-follow-suggestions is the fun to view suggestions.
seeing as this allows easy display of profile note under the account handle, i
also added this display to --search-query, but it cd be easily disabled by
calling --insert-users-propertized without its second arg.
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r-- | lisp/mastodon-search.el | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 5fee328..6c85965 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -97,19 +97,7 @@ Returns a nested list containing user handle, display name, and URL." " USERS\n" " ------------\n\n") 'success)) - (mapc (lambda (el) - (insert (propertize (car el) 'face 'mastodon-display-name-face) - " : \n : " - (propertize (concat "@" (car (cdr el))) - 'face 'mastodon-handle-face - 'mouse-face 'highlight - 'mastodon-tab-stop 'user-handle - 'keymap mastodon-tl--link-keymap - 'mastodon-handle (concat "@" (car (cdr el))) - 'help-echo (concat "Browse user profile of @" (car (cdr el)))) - " : \n" - "\n")) - user-ids) + (mastodon-search--insert-users-propertized user-ids :note) ;; hashtag results: (insert (mastodon-tl--set-face (concat "\n ------------\n" @@ -135,11 +123,33 @@ Returns a nested list containing user handle, display name, and URL." (mapc 'mastodon-tl--toot toots-list-json) (goto-char (point-min)))))) +(defun mastodon-search--insert-users-propertized (users &optional note) + "Insert USERS list into the buffer. +If NOTE is non-nil, include user's profile note. +This is also called by `mastodon-tl--get-follow-suggestions'." + (mapc (lambda (el) + (insert (propertize (car el) 'face 'mastodon-display-name-face) + " : \n : " + (propertize (concat "@" (car (cdr el))) + 'face 'mastodon-handle-face + 'mouse-face 'highlight + 'mastodon-tab-stop 'user-handle + 'keymap mastodon-tl--link-keymap + 'mastodon-handle (concat "@" (car (cdr el))) + 'help-echo (concat "Browse user profile of @" (car (cdr el)))) + " : \n" + (if note + (mastodon-tl--render-text (cadddr el) nil) + "") + "\n")) + users)) + (defun mastodon-search--get-user-info (account) - "Get user handle, display name and account URL from ACCOUNT." + "Get user handle, display name, account URL and profile note from ACCOUNT." (list (alist-get 'display_name account) (alist-get 'acct account) - (alist-get 'url account))) + (alist-get 'url account) + (alist-get 'note account))) (defun mastodon-search--get-hashtag-info (tag) "Get hashtag name and URL from TAG." |