aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-08-08 10:52:52 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-08-08 10:52:52 +0200
commit21090d643515ad076c9900d601a1a901f464ccc9 (patch)
tree579a1170678b4ef80caab8e5ec0a542d1e4a5c11 /lisp/mastodon-tl.el
parentbf1c648b219d54aaa1b9fccd61a4bd91226eb96b (diff)
tl: condition-case for next/prev funs
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el33
1 files changed, 15 insertions, 18 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 4e678f6..80c1e42 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -401,21 +401,16 @@ Optionally start from POS."
;; FIXME: we need to fix item-type?
;; 'item-type ; breaks nav to last item in a view?
'byline
- (current-buffer))))
+ (current-buffer)))
+ (max-lisp-eval-depth 4)) ;; clamp down on endless loops
(if npos
- (if (not
- (get-text-property npos 'item-type)) ; generic
+ (if (not (get-text-property npos 'item-type)) ; generic
;; FIXME let's make refresh &optional and only call refresh/recur
;; if non-nil:
(mastodon-tl--goto-item-pos find-pos refresh npos)
(goto-char npos)
;; force display of help-echo on moving to a toot byline:
(mastodon-tl--message-help-echo))
- ;; FIXME: doesn't work, the funcall doesn't return if in an endless
- ;; refresh loop.
- ;; either let-bind `max-lisp-eval-depth' and try to error handle when it
- ;; errors, or else set up a counter, and error when it gets to high
- ;; (like >2 would already be too much)
(condition-case nil
(funcall refresh)
(error "No more items")))))
@@ -426,26 +421,28 @@ 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
- (unless no-refresh 'mastodon-tl--more)))
+ (condition-case err
+ (mastodon-tl--goto-item-pos 'next-single-property-change
+ (unless no-refresh 'mastodon-tl--more))
+ (t (error "No more items"))))
(defun mastodon-tl--goto-prev-item ()
"Jump to previous item.
Update if no previous items"
(interactive)
- (mastodon-tl--goto-item-pos 'previous-single-property-change
- 'mastodon-tl--update))
+ (condition-case err
+ (mastodon-tl--goto-item-pos 'previous-single-property-change
+ 'mastodon-tl--update)
+ (t (error "No more items"))))
(defun mastodon-tl--goto-first-item ()
"Jump to first toot or item in buffer.
Used on initializing a timeline or thread."
- ;; goto-next-item assumes we already have items, and is therefore
- ;; incompatible with any view where it is possible to have no items.
- ;; when that is the case the call to goto-toot-pos loops infinitely
(goto-char (point-min))
- (mastodon-tl--goto-item-pos 'next-single-property-change
- 'next-line))
-;; (mastodon-tl--goto-next-item))
+ (condition-case err
+ (mastodon-tl--goto-item-pos 'next-single-property-change
+ 'next-line)
+ (t (error "No item"))))
;;; TIMELINES