aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-03-04 19:31:47 +0100
committermarty hiatt <martianhiatus@riseup.net>2024-03-04 19:31:47 +0100
commit94f310c78dd6204176425f3805ec8b67d30c9c92 (patch)
tree0f687973b6ed7293ac82c8b008a07394944e24bd /lisp
parentb60de81d7b8113fe622e9a5af149f165fab1dc96 (diff)
add toggle-spoiler-in-thread cmd
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-tl.el20
1 files changed, 17 insertions, 3 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 856325e..18aaccc 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -389,12 +389,14 @@ Optionally start from POS."
(funcall refresh)
(error "No more items")))))
-(defun mastodon-tl--goto-next-item ()
+(defun mastodon-tl--goto-next-item (&optional no-refresh)
"Jump to next item.
-Load more items it no next item."
+Load more items it no next item.
+NO-REFRESH means do no not try to load more items if no next item
+found."
(interactive)
(mastodon-tl--goto-item-pos 'next-single-property-change
- 'mastodon-tl--more))
+ (unless no-refresh 'mastodon-tl--more)))
(defun mastodon-tl--goto-prev-item ()
"Jump to previous item.
@@ -989,6 +991,18 @@ content should be hidden."
(t
(mastodon-tl--toggle-spoiler-text (car spoiler-range))))))
+(defun mastodon-tl--toggle-spoiler-in-thread ()
+ "Toggler content warning for all posts in current thread."
+ (interactive)
+ (let ((thread-p (eq (mastodon-tl--buffer-property 'update-function)
+ 'mastodon-tl--thread)))
+ (if (not thread-p)
+ (user-error "Not in a thread")
+ (goto-char (point-min))
+ (while (not (equal "No more items" ; improve this hack test!
+ (mastodon-tl--goto-next-item :no-refresh)))
+ (mastodon-tl--toggle-spoiler-text-in-toot)))))
+
(defun mastodon-tl--clean-tabs-and-nl (string)
"Remove tabs and newlines from STRING."
(replace-regexp-in-string "[\t\n ]*\\'" "" string))