diff options
author | mousebot <mousebot@riseup.net> | 2021-10-21 14:35:40 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-10-21 14:41:05 +0200 |
commit | c08bc9dea693388a779d5702fc6cc421353bb889 (patch) | |
tree | de9e653a41873bd75c9d9e02ef33ae3c0cf158a6 /lisp/mastodon-search.el | |
parent | 156b32132f78ede03e3e6188ecf3bf67790b6846 (diff) |
improvements to toot mentions completion
- customize option for completion off, following-only, or all.
- 'following=true' is forwarded to http--get-search accordingly.
- use company-grab-symbol-cons + regex, prepend "@" to it
- also prepend '@' to the list in get-user-info-no-url
- this makes company display user handles prepended with '@', and to match and
- enter a handle without duplicating the '@'
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r-- | lisp/mastodon-search.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 14e40d8..40f134d 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -48,7 +48,7 @@ (defun mastodon-search--get-user-info-no-url (account) "Get user handle, display name and account URL from ACCOUNT." (list (cdr (assoc 'display_name account)) - (cdr (assoc 'acct account)))) + (concat "@" (cdr (assoc 'acct account))))) (defun mastodon-search--search-accounts-query (query) "Prompt for a search QUERY and return accounts. @@ -56,8 +56,10 @@ Returns a nested list containing user handle, display name, and URL." (interactive "sSearch mastodon for: ") (let* ((url (format "%s/api/v1/accounts/search" mastodon-instance-url)) (buffer (format "*mastodon-search-%s*" query)) - (response (mastodon-http--get-search-json url query))) - (mapcar #'mastodon-search--get-user-info-no-url ;-handle-flat-propertized + (response (if (equal mastodon-toot--enable-completion-for-mentions "followers") + (mastodon-http--get-search-json url query "following=true") + (mastodon-http--get-search-json url query)))) + (mapcar #'mastodon-search--get-user-info-no-url response))) ;; functions for mastodon search |