diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-08-23 10:35:54 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-08-23 10:35:54 +0200 |
commit | ad6e15019541a38323733ee1576b8c8b39cc5f36 (patch) | |
tree | 0ee3cb6da93cd547048524aac574a58efef48836 /lisp/mastodon-search.el | |
parent | d914d579221504f85ae95b0dec7fd9abedbd30a7 (diff) |
implement tags company completion
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r-- | lisp/mastodon-search.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index cbb1fba..5756ae4 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -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") (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 |