aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/mastodon-tl.el28
1 files changed, 17 insertions, 11 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 67047a3..2fbc889 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -993,23 +993,29 @@ webapp"
(mastodon-tl--goto-next-toot))
(message "No Thread!"))))
-(defun mastodon-tl--create-filter (word contexts)
- "Create a filter for WORD.
-CONTEXTS must be a list containting at least one of \"home\",
-\"notifications\", \"public\", \"thread\". "
+(defun mastodon-tl--create-filter ()
+ "Create a filter for a word.
+Prompt for a context, must be a list containting at least one of \"home\",
+\"notifications\", \"public\", \"thread\"."
(interactive)
(let* ((url (mastodon-http--api "filters"))
+ (word (read-string
+ (format "Word to filter (%s): " (current-word))
+ nil nil (current-word)))
+ (contexts (completing-read-multiple
+ "Contexts to filter [TAB for options]:"
+ '("home" "notifications" "public" "thread")))
(contexts-processed
(mapcar (lambda (x)
(cons "context[]" x))
contexts))
- (response
- (mastodon-http--post url (push
- `("phrase" . ,word)
- contexts-processed)
- nil)))
- (with-current-buffer response
- (switch-to-buffer (current-buffer)))))
+ (response (mastodon-http--post url (push
+ `("phrase" . ,word)
+ contexts-processed)
+ nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (message "Filter created for %s!" word)))))
(defun mastodon-tl--get-follow-suggestions ()
"Display a buffer of suggested accounts to follow."