diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-08-03 21:58:47 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-08-03 22:06:59 +0200 |
commit | 1648b227fb6a42d1053fc1fd1b9555fab1add2c8 (patch) | |
tree | 682d192e688dceeee747678a7ca7f036b399eb49 | |
parent | c06f1a14cceb02ba702c1a67d6ba97f3badc2a7b (diff) |
cycle thru profile view: toots, followers, following
-rw-r--r-- | lisp/mastodon-discover.el | 6 | ||||
-rw-r--r-- | lisp/mastodon-profile.el | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index 7046070..a63d500 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -89,9 +89,9 @@ ("-" "zoom out" 'image-decrease-size) ("u" "copy URL" 'shr-maybe-probe-and-copy-url)) ("Profile view" - ("o" "Show following" mastodon-profile--open-following) - ("O" "Show followers" mastodon-profile--open-followers) - + ("g" "Show following" mastodon-profile--open-following) + ("s" "Show followers" mastodon-profile--open-followers) + ("C-c C-c" "Cycle profile views" mastodon-profile-account-view-cycle) ("R" "View follow requests" mastodon-profile--view-follow-requests) ("a" "Accept follow request" mastodon-profile--follow-request-accept) ("j" "Reject follow request" mastodon-profile--follow-request-reject) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 6065bdd..0458e73 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -78,6 +78,7 @@ (let ((map (make-sparse-keymap))) (define-key map (kbd "s") #'mastodon-profile--open-followers) (define-key map (kbd "g") #'mastodon-profile--open-following) + (define-key map (kbd "C-c C-c") #'mastodon-profile--account-view-cycle) map) "Keymap for `mastodon-profile-mode'.") @@ -88,7 +89,7 @@ (define-key map (kbd "a") #'mastodon-notifications--follow-request-accept) (define-key map (kbd "n") #'mastodon-tl--goto-next-item) (define-key map (kbd "p") #'mastodon-tl--goto-prev-item) - (define-key map (kbd "g") 'mastodon-profile--view-follow-requests) + (define-key map (kbd "g") #'mastodon-profile--view-follow-requests) ;; (define-key map (kbd "t") #'mastodon-toot) ;; (define-key map (kbd "q") #'kill-current-buffer) ;; (define-key map (kbd "Q") #'kill-buffer-and-window) @@ -130,6 +131,19 @@ extra keybindings." (mastodon-profile--make-profile-buffer-for account "statuses" #'mastodon-tl--timeline)) +;; TODO: we shd just load all views' data then switch coz this is slow af: +(defun mastodon-profile-account-view-cycle () + "Cycle through profile view: toots, followers, and following." + (interactive) + (let ((endpoint (plist-get mastodon-tl--buffer-spec 'endpoint))) + (cond ((string-suffix-p "statuses" endpoint) + (mastodon-profile--open-followers)) + ((string-suffix-p "followers" endpoint) + (mastodon-profile--open-following)) + (t + (mastodon-profile--make-profile-buffer-for + mastodon-profile--account "statuses" #'mastodon-tl--timeline))))) + (defun mastodon-profile--open-following () "Open a profile buffer showing the accounts that current profile follows." (interactive) @@ -420,7 +434,8 @@ If toot is a boost, opens the profile of the booster." (if account (progn (message "Loading profile of user %s..." user-handle) - (mastodon-profile--make-author-buffer account)) + (mastodon-profile--make-author-buffer account) + (message "'C-c C-c' to cycle profile views: toots, followers, following")) (message "Cannot find a user with handle %S" user-handle))))) (defun mastodon-profile--my-profile () |