From 13162773b6fcff121bf3449075201a49547f68c4 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 1 Jun 2024 10:39:50 +0200 Subject: max-id arg/params for (so far only plain) profile view --- lisp/mastodon-profile.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 46a56f6..37a6ec4 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -146,7 +146,7 @@ This variable is set from data in (mastodon-tl--property 'item-json)) (defun mastodon-profile--make-author-buffer - (account &optional no-reblogs no-replies only-media tag) + (account &optional no-reblogs no-replies only-media tag max-id) "Take an ACCOUNT json and insert a user account into a new buffer. NO-REBLOGS means do not display boosts in statuses. NO-REPLIES means to exlude replies. @@ -154,7 +154,7 @@ ONLY-MEDIA means show only posts containing attachments. TAG is a hashtag to restrict posts to." (mastodon-profile--make-profile-buffer-for account "statuses" #'mastodon-tl--timeline no-reblogs nil - no-replies only-media tag)) + no-replies only-media tag max-id)) ;; TODO: we shd just load all views' data then switch coz this is slow af: (defun mastodon-profile--account-view-cycle () @@ -594,7 +594,7 @@ FIELDS means provide a fields vector fetched by other means." (defun mastodon-profile--make-profile-buffer-for (account endpoint-type update-function - &optional no-reblogs headers no-replies only-media tag) + &optional no-reblogs headers no-replies only-media tag max-id) "Display profile of ACCOUNT, using ENDPOINT-TYPE and UPDATE-FUNCTION. NO-REBLOGS means do not display boosts in statuses. HEADERS means also fetch link headers for pagination. @@ -602,7 +602,11 @@ NO-REPLIES means to exlude replies. ONLY-MEDIA means show only posts containing attachments. TAG is a hashtag to restrict posts to." (let-alist account - (let* ((args `(("limit" . ,mastodon-tl--timeline-posts-count))) + (let* ((max-id-str (when max-id + (mastodon-tl--buffer-property 'max-id))) + (args `(("limit" . ,mastodon-tl--timeline-posts-count) + ,(when max-id + `("max_id" . ,max-id-str)))) (args (cond (no-reblogs (push '("exclude_reblogs" . "t") args)) (no-replies @@ -637,9 +641,8 @@ TAG is a hashtag to restrict posts to." (mastodon-profile-mode) (remove-overlays) (setq mastodon-profile--account account) - (mastodon-tl--set-buffer-spec buffer endpoint - update-function link-header - args) + (mastodon-tl--set-buffer-spec buffer endpoint update-function + link-header args nil max-id-str) (let* ((inhibit-read-only t) (is-statuses (string= endpoint-type "statuses")) (is-followers (string= endpoint-type "followers")) @@ -748,12 +751,13 @@ the format \"2000-01-31T00:00:00.000Z\"." (format-time-string "Joined: %d %B %Y" (parse-iso8601-time-string joined))) -(defun mastodon-profile--get-toot-author () +(defun mastodon-profile--get-toot-author (&optional max-id) "Open profile of author of toot under point. If toot is a boost, opens the profile of the booster." (interactive) (mastodon-profile--make-author-buffer - (alist-get 'account (mastodon-profile--item-json)))) + (alist-get 'account (mastodon-profile--item-json)) + nil nil nil nil max-id)) (defun mastodon-profile--image-from-account (account img-type) "Return a avatar image from ACCOUNT. -- cgit v1.2.3 From 63a07d2ff4bff73d377ab4931cf0fb1fd7d51146 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 2 Jun 2024 10:51:48 +0200 Subject: flycheck --- lisp/mastodon-notifications.el | 2 +- lisp/mastodon-profile.el | 9 ++++++--- lisp/mastodon-tl.el | 12 ++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index c26d0b0..5806893 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -261,7 +261,7 @@ Status notifications are given when (equal type 'follow-request) (equal type 'mention)) 'mastodon-tl--byline-author - (lambda (_status &rest args) ; unbreak stuff + (lambda (_status &rest _args) ; unbreak stuff (mastodon-tl--byline-author note))) ;; action-byline (lambda (_status) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 37a6ec4..b96caa0 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -151,7 +151,8 @@ This variable is set from data in NO-REBLOGS means do not display boosts in statuses. NO-REPLIES means to exlude replies. ONLY-MEDIA means show only posts containing attachments. -TAG is a hashtag to restrict posts to." +TAG is a hashtag to restrict posts to. +MAX-ID is a flag to include the max_id pagination parameter." (mastodon-profile--make-profile-buffer-for account "statuses" #'mastodon-tl--timeline no-reblogs nil no-replies only-media tag max-id)) @@ -600,7 +601,8 @@ NO-REBLOGS means do not display boosts in statuses. HEADERS means also fetch link headers for pagination. NO-REPLIES means to exlude replies. ONLY-MEDIA means show only posts containing attachments. -TAG is a hashtag to restrict posts to." +TAG is a hashtag to restrict posts to. +MAX-ID is a flag to include the max_id pagination parameter." (let-alist account (let* ((max-id-str (when max-id (mastodon-tl--buffer-property 'max-id))) @@ -753,7 +755,8 @@ the format \"2000-01-31T00:00:00.000Z\"." (defun mastodon-profile--get-toot-author (&optional max-id) "Open profile of author of toot under point. -If toot is a boost, opens the profile of the booster." +If toot is a boost, opens the profile of the booster. +MAX-ID is a flag to include the max_id pagination parameter." (interactive) (mastodon-profile--make-author-buffer (alist-get 'account (mastodon-profile--item-json)) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 28177bc..949414c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -465,7 +465,8 @@ With a double PREFIX arg, only show posts with media." (defun mastodon-tl--get-home-timeline (&optional arg max-id) "Open home timeline. -With a single prefix ARG, hide replies." +With a single prefix ARG, hide replies. +MAX-ID is a flag to add the max_id pagination parameter." (interactive "p") (let* ((params `(("limit" . ,mastodon-tl--timeline-posts-count) @@ -516,7 +517,8 @@ Use this to re-load remote-local items in order to interact with them." (defun mastodon-tl--get-local-timeline (&optional prefix max-id) "Open local timeline. With a single PREFIX arg, hide-replies. -With a double PREFIX arg, only show posts with media." +With a double PREFIX arg, only show posts with media. +MAX-ID is a flag to add the max_id pagination parameter." (interactive "p") (message "Loading local timeline...") (mastodon-tl--get-federated-timeline prefix :local max-id)) @@ -1671,7 +1673,8 @@ BUFFER is buffer name, ENDPOINT is buffer's enpoint, UPDATE-FUN is its update function. LINK-HEADER is the http Link header if present. UPDATE-PARAMS is any http parameters needed for the update function. -HIDE-REPLIES is a flag indicating if replies are hidden in the current buffer." +HIDE-REPLIES is a flag indicating if replies are hidden in the current buffer. +MAX-ID is the pagination parameter." (setq mastodon-tl--buffer-spec `(account ,(cons mastodon-active-user mastodon-instance-url) @@ -2646,7 +2649,8 @@ and profile pages when showing followers or accounts followed." "Append older toots to timeline, asynchronously. Runs the timeline's update function on RESPONSE, in BUFFER. When done, places point at POINT-BEFORE. -HEADERS is the http headers returned in the response, if any." +HEADERS is the http headers returned in the response, if any. +MAX-ID is the pagination parameter, a string." (with-current-buffer buffer (if (not response) (message "No more results") -- cgit v1.2.3 From 5e7e38a81a99e110ec62c0ccc622eb3c4b476cbc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 3 Jun 2024 16:36:07 +0200 Subject: boxed face for "pinned" in profile view --- lisp/mastodon-profile.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index b96caa0..069334a 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -573,7 +573,11 @@ FIELDS means provide a fields vector fetched by other means." (defun mastodon-profile--insert-statuses-pinned (pinned-statuses) "Insert each of the PINNED-STATUSES for a given account." (mapc (lambda (pinned-status) - (insert (mastodon-tl--set-face " :pinned: " 'success)) + (insert + (concat " " + (propertize " pinned " + 'face '(:inherit success :box t)) + " ")) (mastodon-tl--toot pinned-status)) pinned-statuses)) -- cgit v1.2.3 From bd2f44911044f64c3303d080649ca2571b876ce1 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 4 Jun 2024 17:19:54 +0200 Subject: add remove-overlays to with-mastodon-buffer macro --- lisp/mastodon-profile.el | 1 - lisp/mastodon-tl.el | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 069334a..de16b7d 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -645,7 +645,6 @@ MAX-ID is a flag to include the max_id pagination parameter." (relationships (mastodon-profile--relationships-get .id))) (with-mastodon-buffer buffer #'mastodon-mode nil (mastodon-profile-mode) - (remove-overlays) (setq mastodon-profile--account account) (mastodon-tl--set-buffer-spec buffer endpoint update-function link-header args nil max-id-str) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 573c2fa..00e3ce3 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -322,6 +322,7 @@ than `pop-to-buffer'." (let ((inhibit-read-only t)) (erase-buffer) (funcall ,mode-fun) + (remove-overlays) ; video overlays (if ,other-window (switch-to-buffer-other-window ,buffer) (pop-to-buffer ,buffer '(display-buffer-same-window))) @@ -1979,7 +1980,6 @@ view all branches of a thread." ;; if we have a thread: (with-mastodon-buffer buffer #'mastodon-mode nil (let ((marker (make-marker))) - (remove-overlays) ; video overlays (mastodon-tl--set-buffer-spec buffer endpoint #'mastodon-tl--thread) (mastodon-tl--timeline (alist-get 'ancestors context) :thread) -- cgit v1.2.3