aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-21 09:48:10 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-21 09:54:39 +0100
commitf50f726f55d42d5a43a79627574a88c46e0770fe (patch)
treed9ef0e38421ece446cce9ef4fefefeb9043dc4e8 /lisp
parentea155f08605f422c0e6dc96657ce00547b12d67f (diff)
paginate bookmarks timeline (3/4 working?)
seems tl--more seems to repeat bookmarks after 3-4 loads. a similar issue was solved with favourites, but it was always after 2nd load. and we are using the fixed code here already. i have many more favourites than bookmarks. but still it would be nice to not seem to load more when we hit the end.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-profile.el3
-rw-r--r--lisp/mastodon-tl.el10
2 files changed, 9 insertions, 4 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 226da95..f81441e 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -203,7 +203,8 @@ contains")
(message "Loading your bookmarked toots...")
(mastodon-tl--init "bookmarks"
"bookmarks"
- 'mastodon-tl--timeline))
+ 'mastodon-tl--timeline
+ :headers))
(defun mastodon-profile--view-follow-requests ()
"Open a new buffer displaying the user's follow requests."
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 20ac788..d7b977f 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -128,6 +128,10 @@ If nil `(point-min)' is used instead.")
(defvar-local mastodon-tl--timestamp-update-timer nil
"The timer that, when set will scan the buffer to update the timestamps.")
+(defvar mastodon-tl--link-header-buffers
+ '("*mastodon-favourites*" "*mastodon-bookmarks*")
+ "A list of buffers that use link headers for pagination.")
+
(defvar mastodon-tl--link-keymap
(let ((map (make-sparse-keymap)))
(define-key map [return] 'mastodon-tl--do-link-action-at-point)
@@ -1232,7 +1236,7 @@ Optionally get it for BUFFER."
(mastodon-tl--get-buffer-property 'buffer-name buffer))
(defun mastodon-tl--link-header (&optional buffer)
- "Get the BUFFER-NAME stored in `mastodon-tl--buffer-spec'.
+ "Get the LINK HEADER stored in `mastodon-tl--buffer-spec'.
Optionally get it for BUFFER."
(mastodon-tl--get-buffer-property 'link-header buffer))
@@ -2213,10 +2217,10 @@ For use after e.g. deleting a toot."
"Append older toots to timeline, asynchronously."
(interactive)
(message "Loading older toots...")
- (if (string= (buffer-name (current-buffer)) "*mastodon-favourites*")
+ (if (member (buffer-name (current-buffer)) mastodon-tl--link-header-buffers)
;; link-header: can't build a URL with --more-json-async, endpoint/id:
(let* ((next (car (mastodon-tl--link-header)))
- (prev (cadr (mastodon-tl--link-header)))
+ ;(prev (cadr (mastodon-tl--link-header)))
(url (mastodon-tl--build-link-header-url next)))
(mastodon-http--get-response-async url 'mastodon-tl--more* (current-buffer)
(point) :headers))