From 267b8f9fff61c44cc817c662ce9dfb5b40d9a42f Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 14 Oct 2023 15:56:01 +0200 Subject: refactor/rename mastodon-search--insert-heading --- lisp/mastodon-search.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lisp') 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 -- cgit v1.2.3