aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-search.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-14 15:56:01 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-14 15:56:01 +0200
commit267b8f9fff61c44cc817c662ce9dfb5b40d9a42f (patch)
tree17ee042bc5c66596f1ba3e7699e26b5c9fc17a62 /lisp/mastodon-search.el
parent45fd842fe2f2cb1210d44c869140d4ca542e088e (diff)
refactor/rename mastodon-search--insert-heading
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r--lisp/mastodon-search.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el
index 41e4f23..3fd552d 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -122,22 +122,20 @@ PRINT-FUN is the function used to print the data from the response."
(format "trends/%s" type)
print-fun nil
params)
- (insert (mastodon-tl--set-face
- (concat "\n " mastodon-tl--horiz-bar "\n"
- (upcase (format " TRENDING %s\n" type))
- " " mastodon-tl--horiz-bar "\n\n")
- 'success))
+ (mastodon-search--insert-heading "trending" type)
(funcall print-fun data)
(unless (equal type "statuses")
(goto-char (point-min))))))
;; functions for mastodon search
-(defun mastodon-search--format-heading (heading)
- "Format HEADING as a heading."
+(defun mastodon-search--insert-heading (heading &optional type)
+ "Format HEADING as a heading.
+Optionally add string TYPE after HEADING."
(insert
(mastodon-tl--set-face (concat "\n " mastodon-tl--horiz-bar "\n "
- heading "\n"
+ (upcase heading) " "
+ (if type (upcase type) "") "\n"
" " mastodon-tl--horiz-bar "\n")
'success)))
@@ -186,7 +184,7 @@ is used for pagination."
(alist-get 'statuses response))))
(with-mastodon-buffer buffer #'mastodon-mode nil
(mastodon-search-mode)
- (mastodon-search--format-heading (upcase type))
+ (mastodon-search--insert-heading type)
;; user results:
(cond ((equal type "accounts")
(mastodon-search--render-response accts type buffer params