branch: elpa/mastodon
commit 2b426fb913b248d161122de9cca5368c60f72cea
Author: marty hiatt <martianhia...@riseup.net>
Commit: marty hiatt <martianhia...@riseup.net>

    working max-id arg for hometimeline/reload
---
 lisp/mastodon-tl.el   | 19 ++++++++++++-------
 lisp/mastodon-toot.el |  2 ++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 14603b807e..070c15361a 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -460,14 +460,18 @@ With a double PREFIX arg, only show posts with media."
                        params
                        (when (eq prefix 4) t))))
 
-(defun mastodon-tl--get-home-timeline (&optional arg)
+(defun mastodon-tl--get-home-timeline (&optional arg max-id)
   "Open home timeline.
 With a single prefix ARG, hide replies."
   (interactive "p")
-  (message "Loading home timeline...")
-  (mastodon-tl--init "home" "timelines/home" 'mastodon-tl--timeline nil
-                     `(("limit" . ,mastodon-tl--timeline-posts-count))
-                     (when (eq arg 4) t)))
+  (let* ((params
+          `(("limit" . ,mastodon-tl--timeline-posts-count)
+            ,(when max-id
+               `("max_id" . ,(mastodon-tl--buffer-property 'max-id))))))
+    (message "Loading home timeline...")
+    (mastodon-tl--init "home" "timelines/home" 'mastodon-tl--timeline nil
+                       params ;`(("limit" . 
,mastodon-tl--timeline-posts-count))
+                       (when (eq arg 4) t))))
 
 (defun mastodon-tl--get-remote-local-timeline ()
   "Prompt for an instance domain and try to display its local timeline.
@@ -2544,10 +2548,11 @@ the current view."
 (defun mastodon-tl--reload-timeline-or-profile (&optional pos)
   "Reload the current timeline or profile page.
 For use after e.g. deleting a toot.
-POS is a number, where point will be placed."
+POS is a number, where point will be placed.
+Aims to respect any pagination in effect."
   (let ((type (mastodon-tl--get-buffer-type)))
     (cond ((eq type 'home)
-           (mastodon-tl--get-home-timeline))
+           (mastodon-tl--get-home-timeline nil :max-id))
           ((eq type 'federated)
            (mastodon-tl--get-federated-timeline))
           ((eq type 'local)
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 654918cc4c..aaff19bb41 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -906,6 +906,7 @@ instance to edit a toot."
              (mastodon-http--triage
               response
               (lambda (_)
+                ;; kill buffer:
                 (mastodon-toot--kill)
                 (if scheduled
                     (message "Toot scheduled!")
@@ -914,6 +915,7 @@ instance to edit a toot."
                 (when scheduled-id
                   (mastodon-views--cancel-scheduled-toot
                    scheduled-id :no-confirm))
+                ;; window config:
                 (mastodon-toot--restore-previous-window-config 
prev-window-config)
                 ;; reload previous view in certain cases:
                 ;; we reload: - when we have been editing

Reply via email to