aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-19 15:53:29 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-19 15:53:29 +0100
commit6575858c101a7536a265c89534137692e5488265 (patch)
treec737f775db81546387b09f82270bc2b2034bad41
parent61024cb96750f11ade4c42f872f3d6b44f53423b (diff)
refactor search--propertize-user
-rw-r--r--lisp/mastodon-search.el46
1 files changed, 25 insertions, 21 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el
index 6422716..31fcae3 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -167,29 +167,33 @@ user's profile note. This is also called by
`mastodon-tl--get-follow-suggestions' and
`mastodon-profile--insert-follow-requests'."
(mapc (lambda (acct)
- (let ((user (mastodon-search--get-user-info acct)))
- (insert
- (propertize
- (concat (propertize (car user)
- 'face 'mastodon-display-name-face
- 'byline t
- 'toot-id "0")
- " : \n : "
- (propertize (concat "@" (cadr user))
- 'face 'mastodon-handle-face
- 'mouse-face 'highlight
- 'mastodon-tab-stop 'user-handle
- 'keymap mastodon-tl--link-keymap
- 'mastodon-handle (concat "@" (cadr user))
- 'help-echo (concat "Browse user profile of @" (cadr user)))
- " : \n"
- (if note
- (mastodon-tl--render-text (cadddr user) nil)
- "")
- "\n")
- 'toot-json acct)))) ; so named for compat w other processing functions
+ (insert (mastodon-search--propertize-user acct note)))
json))
+(defun mastodon-search--propertize-user (acct &optional note)
+ "Propertize display string for ACCT, optionally including profile
+NOTE."
+ (let ((user (mastodon-search--get-user-info acct)))
+ (propertize
+ (concat (propertize (car user)
+ 'face 'mastodon-display-name-face
+ 'byline t
+ 'toot-id "0")
+ " : \n : "
+ (propertize (concat "@" (cadr user))
+ 'face 'mastodon-handle-face
+ 'mouse-face 'highlight
+ 'mastodon-tab-stop 'user-handle
+ 'keymap mastodon-tl--link-keymap
+ 'mastodon-handle (concat "@" (cadr user))
+ 'help-echo (concat "Browse user profile of @" (cadr user)))
+ " : \n"
+ (if note
+ (mastodon-tl--render-text (cadddr user) nil)
+ "")
+ "\n")
+ 'toot-json acct))) ; so named for compat w other processing functions
+
(defun mastodon-search--print-tags-list (tags)
"Insert a propertized list of TAGS."
(mapc (lambda (el)