diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-10 08:39:27 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-10 08:39:27 +0200 |
commit | 528494a2340c46cdf5d589cc95d16d7b3b1a1208 (patch) | |
tree | 3a77a842c0cb32a1ebb44fe2f03d60e664b8cda8 | |
parent | b302dafd3a116b7f26326dd13247f131b728f132 (diff) |
refactor format-heading in search.el
-rw-r--r-- | lisp/mastodon-search.el | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 4b5f2e0..5e0cc20 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -135,6 +135,14 @@ PRINT-FUN is the function used to print the data from the response." ;; functions for mastodon search +(defun mastodon-search--format-heading (heading) + "Format HEADING as a heading." + (insert + (mastodon-tl--set-face (concat "\n " mastodon-tl--horiz-bar "\n " + heading "\n" + " " mastodon-tl--horiz-bar "\n") + 'success))) + (defun mastodon-search--search-query (query) "Prompt for a search QUERY and return accounts, statuses, and hashtags." (interactive "sSearch mastodon for: ") @@ -156,25 +164,13 @@ PRINT-FUN is the function used to print the data from the response." "api/v2/search" nil) ;; user results: - (insert (mastodon-tl--set-face - (concat "\n " mastodon-tl--horiz-bar "\n" - " USERS\n" - " " mastodon-tl--horiz-bar "\n\n") - 'success)) + (mastodon-search--format-heading "USERS") (mastodon-search--insert-users-propertized accts :note) ;; hashtag results: - (insert (mastodon-tl--set-face - (concat "\n " mastodon-tl--horiz-bar "\n" - " HASHTAGS\n" - " " mastodon-tl--horiz-bar "\n\n") - 'success)) + (mastodon-search--format-heading "HASHTAGS") (mastodon-search--print-tags-list tags-list) ;; status results: - (insert (mastodon-tl--set-face - (concat "\n " mastodon-tl--horiz-bar "\n" - " STATUSES\n" - " " mastodon-tl--horiz-bar "\n") - 'success)) + (mastodon-search--format-heading "STATUSES") (mapc #'mastodon-tl--toot toots-list-json) (goto-char (point-min))))) |