aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-05-31 09:11:43 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-05-31 09:11:43 +0200
commit0312b494a685af358005cc2ed6245f8438db8c31 (patch)
tree2dba42abde9058b60b8905440c39410bfe75fc1a
parent78d4d9a29dd95abf16e5cee6019e295b3e3642d6 (diff)
add unfilter user filter langs option to filter user langs
-rw-r--r--lisp/mastodon-tl.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index bbc4b62..aa70507 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2102,7 +2102,9 @@ desired language if they are not marked as such (or as anything)."
(list (mastodon-tl--user-handles-get "filter by language")))
(let ((langs (mastodon-tl--read-filter-langs)))
(mastodon-tl--do-if-item
- (mastodon-tl--follow-user user-handle nil langs))))
+ (if (equal "" (cdar langs))
+ (mastodon-tl--unfilter-user-languages user-handle)
+ (mastodon-tl--follow-user user-handle nil langs)))))
(defun mastodon-tl--unfilter-user-languages (user-handle)
"Remove any language filters for USER-HANDLE.
@@ -2119,12 +2121,14 @@ any or no language."
(defun mastodon-tl--read-filter-langs (&optional langs)
"Read language choices and return an alist array parameter.
LANGS is the accumulated array param alist if we re-run recursively."
- (let* ((langs-alist langs)
+ (let* ((iso-const mastodon-iso-639-1)
+ (iso (cons '("None (all)" . "") iso-const))
+ (langs-alist langs)
(choice (completing-read "Filter user's posts by language: "
- mastodon-iso-639-1)))
+ iso)))
(when choice
(setq langs-alist
- (push `("languages[]" . ,(alist-get choice mastodon-iso-639-1
+ (push `("languages[]" . ,(alist-get choice iso
nil nil #'string=))
langs-alist))
(if (y-or-n-p "Filter by another language? ")