diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-15 08:19:39 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-15 08:19:39 +0100 |
commit | b1a3fd043383b4c19ca3bae21d965365c565be15 (patch) | |
tree | d0171316b7558d0e46868095eed85b383949c46f /lisp | |
parent | 8214f35db91aca0f71dfdb15b0e42a511f31fb61 (diff) |
make sure get-buffer-type really works in all views
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 31ef328..36511ef 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1365,15 +1365,15 @@ this just means displaying toot client." Optionally get it for BUFFER." (mastodon-tl--get-buffer-property 'update-function buffer)) -(defun mastodon-tl--get-endpoint (&optional buffer) +(defun mastodon-tl--get-endpoint (&optional buffer no-error) "Get the ENDPOINT stored in `mastodon-tl--buffer-spec'. Optionally set it for BUFFER." - (mastodon-tl--get-buffer-property 'endpoint buffer)) + (mastodon-tl--get-buffer-property 'endpoint buffer no-error)) -(defun mastodon-tl--buffer-name (&optional buffer) +(defun mastodon-tl--buffer-name (&optional buffer no-error) "Get the BUFFER-NAME stored in `mastodon-tl--buffer-spec'. Optionally get it for BUFFER." - (mastodon-tl--get-buffer-property 'buffer-name buffer)) + (mastodon-tl--get-buffer-property 'buffer-name buffer no-error)) (defun mastodon-tl--link-header (&optional buffer) "Get the LINK HEADER stored in `mastodon-tl--buffer-spec'. @@ -1417,59 +1417,61 @@ Should work in all mastodon buffers." (cond (mastodon-toot-mode 'compose-toot) ;; main timelines: - ((string= "timelines/home" (mastodon-tl--get-endpoint)) + ((string= "timelines/home" (mastodon-tl--get-endpoint nil :no-error)) 'home) - ((string= "timelines/public" (mastodon-tl--get-endpoint)) - 'federated) - ((string= "*mastodon-local*" (mastodon-tl--buffer-name)) + ((string= "*mastodon-local*" (mastodon-tl--buffer-name nil :no-error)) 'local) - ((string-prefix-p "timelines/tag/" (mastodon-tl--get-endpoint)) - 'tag-timeline) - ((string-prefix-p "timelines/list/" (mastodon-tl--get-endpoint)) + ((string= "timelines/public" (mastodon-tl--get-endpoint nil :no-error)) + 'federated) + ((string-prefix-p "timelines/tag/" (mastodon-tl--get-endpoint nil :no-error)) 'tag-timeline) + ((string-prefix-p "timelines/list/" (mastodon-tl--get-endpoint nil :no-error)) + 'list-timeline) ;; notifs: - ((string= "notifications" (mastodon-tl--get-endpoint)) + ((string-suffix-p "mentions*" (mastodon-tl--buffer-name nil :no-error)) + 'mentions) + ((string= "notifications" (mastodon-tl--get-endpoint nil :no-error)) 'notifications) - ;; NB: check for mentions/filtering ;; threads: - ((string-suffix-p "context" (mastodon-tl--get-endpoint)) + ((string-suffix-p "context" (mastodon-tl--get-endpoint nil :no-error)) 'thread) ;; profiles: - ((string-prefix-p "accounts" (mastodon-tl--get-endpoint)) - (cond ; posts - ((string-suffix-p "statuses" (mastodon-tl--get-endpoint)) + ((string-prefix-p "accounts" (mastodon-tl--get-endpoint nil :no-error)) + (cond + ;; profile note: + ((string-suffix-p "update-profile*" (mastodon-tl--buffer-name nil :no-error)) + 'update-profile-note) + ;; posts + ((string-suffix-p "statuses" (mastodon-tl--get-endpoint nil :no-error)) 'profile-statuses) ;; profile followers - ((string-suffix-p "followers" (mastodon-tl--get-endpoint)) + ((string-suffix-p "followers" (mastodon-tl--get-endpoint nil :no-error)) 'profile-followers) ;; profile following - ((string-suffix-p "following" (mastodon-tl--get-endpoint)) + ((string-suffix-p "following" (mastodon-tl--get-endpoint nil :no-error)) 'profile-following))) ;; search - ((string-suffix-p "search" (mastodon-tl--get-endpoint)) + ((string-suffix-p "search" (mastodon-tl--get-endpoint nil :no-error)) 'search) - ((string-suffix-p "trends" (mastodon-tl--get-endpoint)) + ((string-suffix-p "trends" (mastodon-tl--get-endpoint nil :no-error)) 'trending-tags) ;; User's views: - ((string= "filters" (mastodon-tl--get-endpoint)) + ((string= "filters" (mastodon-tl--get-endpoint nil :no-error)) 'filters) - ((string= "lists" (mastodon-tl--get-endpoint)) - 'lists) - ((string= "suggestions" (mastodon-tl--get-endpoint)) + ((string= "lists" (mastodon-tl--get-endpoint nil :no-error)) + 'lists-view) + ((string= "suggestions" (mastodon-tl--get-endpoint nil :no-error)) 'follow-suggestions) - ((string= "favourites" (mastodon-tl--get-endpoint)) + ((string= "favourites" (mastodon-tl--get-endpoint nil :no-error)) 'favourites) - ((string= "bookmarks" (mastodon-tl--get-endpoint)) + ((string= "bookmarks" (mastodon-tl--get-endpoint nil :no-error)) 'bookmarks) - ((string= "follow_requests" (mastodon-tl--get-endpoint)) + ((string= "follow_requests" (mastodon-tl--get-endpoint nil :no-error)) 'follow-requests) - ((string= "scheduled_statuses" (mastodon-tl--get-endpoint)) + ((string= "scheduled_statuses" (mastodon-tl--get-endpoint nil :no-error)) 'scheduled-statuses) - ;; profile note - ((string-suffix-p "update-profile*" (mastodon-tl--buffer-name)) - 'update-profile-note) ;; instance description - ((string= "instance" (mastodon-tl--get-endpoint)) + ((string= "instance" (mastodon-tl--get-endpoint nil :no-error)) 'instance-description))) (defun mastodon-tl--has-toots-p () |