diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-11 00:23:48 +1100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-11 00:36:36 +1100 |
commit | 3b35b51a36976d64bc3368d6bd8cce5edb350839 (patch) | |
tree | 8d3547294fe3b7cc8e1a147c6606c55e5281a7fa | |
parent | 0db46a8da2af73bc07ac36be43777c522cbfb57d (diff) |
customize number of posts displayed in a timeline or account view
FIXES #363
-rw-r--r-- | README.org | 1 | ||||
-rw-r--r-- | lisp/mastodon-profile.el | 3 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 18 |
3 files changed, 17 insertions, 5 deletions
@@ -269,6 +269,7 @@ See =M-x customize-group RET mastodon= to view all customize options. - Timeline options: - Use proportional fonts + - Default number of posts displayed - Timestamp format - Relative timestamps - Display user avatars diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 7e3262a..f96ecb5 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -621,7 +621,8 @@ FIELDS means provide a fields vector fetched by other means." NO-REBLOGS means do not display boosts in statuses. HEADERS means also fetch link headers for pagination." (let* ((id (mastodon-profile--account-field account 'id)) - (args (when no-reblogs '(("exclude_reblogs" . "t")))) + (args `(("limit" . ,mastodon-tl--timeline-posts-count))) + (args (if no-reblogs (push '("exclude_reblogs" . "t") args) args)) (endpoint (format "accounts/%s/%s" id endpoint-type)) (url (mastodon-http--api endpoint)) (acct (mastodon-profile--account-field account 'acct)) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1ec0208..a86a7e6 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -157,6 +157,11 @@ Valid values are: (const :tag "Keep original position of point" keep-point) (const :tag "The last toot before the new ones" last-old-toot))) +(defcustom mastodon-tl--timeline-posts-count "20" + "Number of posts to display when loading a timeline. +Must be an integer between 20 and 40 inclusive." + :type '(string)) + (defvar-local mastodon-tl--update-point nil "When updating a mastodon buffer this is where new toots will be inserted. If nil `(point-min)' is used instead.") @@ -395,14 +400,16 @@ Used on initializing a timeline or thread." (interactive) (message "Loading federated timeline...") (mastodon-tl--init - "federated" "timelines/public" 'mastodon-tl--timeline)) + "federated" "timelines/public" 'mastodon-tl--timeline nil + `(("limit" . ,mastodon-tl--timeline-posts-count)))) (defun mastodon-tl--get-home-timeline () "Opens home timeline." (interactive) (message "Loading home timeline...") (mastodon-tl--init - "home" "timelines/home" 'mastodon-tl--timeline)) + "home" "timelines/home" 'mastodon-tl--timeline nil + `(("limit" . ,mastodon-tl--timeline-posts-count)))) (defun mastodon-tl--get-local-timeline () "Opens local timeline." @@ -410,7 +417,8 @@ Used on initializing a timeline or thread." (message "Loading local timeline...") (mastodon-tl--init "local" "timelines/public" 'mastodon-tl--timeline - nil '(("local" . "true")))) + nil `(("local" . "true") + ("limit" . ,mastodon-tl--timeline-posts-count)))) (defun mastodon-tl--get-tag-timeline () "Prompt for tag and opens its timeline." @@ -424,7 +432,9 @@ Used on initializing a timeline or thread." (defun mastodon-tl--show-tag-timeline (tag) "Opens a new buffer showing the timeline of posts with hastag TAG." (mastodon-tl--init - (concat "tag-" tag) (concat "timelines/tag/" tag) 'mastodon-tl--timeline)) + (concat "tag-" tag) (concat "timelines/tag/" tag) + 'mastodon-tl--timeline nil + `(("limit" . ,mastodon-tl--timeline-posts-count)))) (defun mastodon-tl--message-help-echo () "Call message on 'help-echo property at point. |