diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-10-12 17:45:40 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-10-12 17:45:40 +0200 |
commit | 3c52d556fcdda625166084206d7030a0806b4744 (patch) | |
tree | 3ec128e2131dc7bb09093c4078cb23402f72fd4f /lisp/mastodon-search.el | |
parent | c5aefef00b841639f94c1e75bea2b4f3f9ff5ce5 (diff) |
add completing-read for search type + message binding
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r-- | lisp/mastodon-search.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index dc9570c..e2faec5 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -141,11 +141,18 @@ PRINT-FUN is the function used to print the data from the response." " " mastodon-tl--horiz-bar "\n") 'success))) +(defvar mastodon-search-types + '("statuses" "accounts" "hashtags")) + (defun mastodon-search--search-query (query &optional type following account-id) "Prompt for a search QUERY and return accounts, statuses, and hashtags." (interactive "sSearch mastodon for: ") (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) + (type (or type + (completing-read "Search type: " + mastodon-search-types + nil t))) (buffer (format "*mastodon-search-%s-%s*" type query)) (params `(("q" . ,query) ,(when type `("type" . ,type)) @@ -178,7 +185,8 @@ PRINT-FUN is the function used to print the data from the response." (when statuses (mastodon-search--format-heading "STATUSES") (mapc #'mastodon-tl--toot statuses)) ;toots-list-json)) - (goto-char (point-min))))) + (goto-char (point-min)) + (message "`C-c' `C-c' to cycle result types.")))) (defun mastodon-search--buf-type () "Return search buffer type, a member of `mastodon-search-types'." |