aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-search.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-27 11:08:57 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-27 11:08:57 +0200
commit61f742f40df98bd79337bb755ff1c30db3da8f02 (patch)
treeba32725a4ad51eac8e14aa578016d87863bcfb0a /lisp/mastodon-search.el
parent0415a6cd1bd19be021c619e52d7b7fd675927cfc (diff)
parented8353064120e8941c617884c361c2cf1898e674 (diff)
Merge branch 'develop'
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r--lisp/mastodon-search.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el
index a1bc2dd..8d450e3 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -40,7 +40,7 @@
(autoload 'mastodon-auth--access-token "mastodon-auth")
(autoload 'mastodon-http--get-search-json "mastodon-http")
(autoload 'mastodon-http--api "mastodon-http")
-
+(defvar mastodon-toot--completion-style-for-mentions)
(defvar mastodon-instance-url)
(defvar mastodon-tl--link-keymap)
(defvar mastodon-http--timeout)
@@ -59,12 +59,22 @@
Returns a nested list containing user handle, display name, and URL."
(interactive "sSearch mastodon for: ")
(let* ((url (mastodon-http--api "accounts/search"))
- ;; (buffer (format "*mastodon-search-%s*" query))
- (response (if (equal mastodon-toot--enable-completion-for-mentions "following")
+ (response (if (equal mastodon-toot--completion-style-for-mentions "following")
(mastodon-http--get-search-json url query "following=true")
(mastodon-http--get-search-json url query))))
- (mapcar #'mastodon-search--get-user-info-@
- response)))
+ (mapcar #'mastodon-search--get-user-info-@ response)))
+
+;; functions for tags completion:
+
+(defun mastodon-search--search-tags-query (query)
+ "Return an alist containing tag strings plus their URLs.
+QUERY is the string to search."
+ (interactive "sSearch for hashtag: ")
+ (let* ((url (format "%s/api/v2/search" mastodon-instance-url))
+ (type-param (concat "type=hashtags"))
+ (response (mastodon-http--get-search-json url query type-param))
+ (tags (alist-get 'hashtags response)))
+ (mapcar #'mastodon-search--get-hashtag-info tags)))
;; functions for mastodon search