aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-02-07 20:43:08 +0100
committermousebot <mousebot@riseup.net>2022-02-09 10:53:40 +0100
commit2c75ce23691b885574c37fe84ab35015c12d4e19 (patch)
tree3ff14b13c405b1e5fcc1bf49dd82f370d4f1b11b /lisp
parent918d34782ae3dba7a891825104affa0160b61b2c (diff)
second crack at create filter
Diffstat (limited to 'lisp')
-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."