diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-03 21:29:27 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-03 21:29:27 +0200 |
commit | 51f8b782ac6721939e20eca459fe88eb4304857c (patch) | |
tree | f8ac598267cc26859b7b48951000f39e2c3683b6 /lisp/mastodon-search.el | |
parent | 718a12d2fc9c16f839735a8e238a01f3174be52e (diff) |
with-mastodon-buffer macro
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r-- | lisp/mastodon-search.el | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 8cfa3cb..86ebb90 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -35,6 +35,7 @@ (autoload 'mastodon-http--get-json "mastodon-http") (autoload 'mastodon-http--get-search-json "mastodon-http") (autoload 'mastodon-mode "mastodon") +(autoload 'with-mastodon-buffer "mastodon") (autoload 'mastodon-tl--as-string "mastodon-tl") (autoload 'mastodon-tl--as-string "mastodon-tl") (autoload 'mastodon-tl--render-text "mastodon-tl") @@ -153,36 +154,33 @@ PRINT-FUN is the function used to print the data from the response." tags)) (toots-list-json (mastodon-search--get-full-statuses-data statuses))) - (with-current-buffer (get-buffer-create buffer) - (switch-to-buffer buffer) - (mastodon-mode) - (let ((inhibit-read-only t)) - (erase-buffer) - (mastodon-tl--set-buffer-spec buffer - "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--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--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)) - (mapc #'mastodon-tl--toot toots-list-json) - (goto-char (point-min)))))) + (with-mastodon-buffer + buffer + (mastodon-tl--set-buffer-spec buffer + "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--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--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)) + (mapc #'mastodon-tl--toot toots-list-json) + (goto-char (point-min))))) (defun mastodon-search--insert-users-propertized (json &optional note) "Insert users list into the buffer. |