emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mastodon 2cfaf7458c 01/18: prefix for profile cycle comple


From: ELPA Syncer
Subject: [nongnu] elpa/mastodon 2cfaf7458c 01/18: prefix for profile cycle completing-read. FIX #624.
Date: Mon, 2 Dec 2024 16:00:32 -0500 (EST)

branch: elpa/mastodon
commit 2cfaf7458c489b6a639bab2c616c64d90eda7f34
Author: marty hiatt <martianhiatus@disroot.org>
Commit: marty hiatt <martianhiatus@disroot.org>

    prefix for profile cycle completing-read. FIX #624.
---
 lisp/mastodon-profile.el | 43 +++++++++++++++++++++++++++++--------------
 1 file changed, 29 insertions(+), 14 deletions(-)

diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index a94fd16423..acbc206cdb 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -163,22 +163,37 @@ MAX-ID is a flag to include the max_id pagination 
parameter."
 
 ;;; PROFILE VIEW COMMANDS
 
+(defvar mastodon-profile--account-view-alist
+  '(("statuses"     . mastodon-profile--open-statuses)
+    ("no boosts"   . mastodon-profile--open-statuses-no-reblogs)
+    ("no replies"    . mastodon-profile--open-statuses-no-replies)
+    ("only media"   . mastodon-profile--open-statuses-only-media)
+    ("followers"    . mastodon-profile--open-followers)
+    ("following"    . mastodon-profile--open-following)))
+
 ;; TODO: we shd just load all views' data then switch coz this is slow af:
-(defun mastodon-profile--account-view-cycle ()
+(defun mastodon-profile--account-view-cycle (&optional prefix)
   "Cycle through profile view: toots, toot sans boosts, followers, and 
following."
-  (interactive)
-  (cond ((mastodon-tl--buffer-type-eq 'profile-statuses)
-         (mastodon-profile--open-statuses-no-reblogs))
-        ((mastodon-tl--buffer-type-eq 'profile-statuses-no-boosts)
-         (mastodon-profile--open-statuses-no-replies))
-        ((mastodon-tl--buffer-type-eq 'profile-statuses-no-replies)
-         (mastodon-profile--open-statuses-only-media))
-        ((mastodon-tl--buffer-type-eq 'profile-statuses-only-media)
-         (mastodon-profile--open-followers))
-        ((mastodon-tl--buffer-type-eq 'profile-followers)
-         (mastodon-profile--open-following))
-        ((mastodon-tl--buffer-type-eq 'profile-following)
-         (mastodon-profile--make-author-buffer mastodon-profile--account))))
+  (interactive "P")
+  (if prefix
+      (let* ((choice
+              (completing-read "Profile view:"
+                               mastodon-profile--account-view-alist))
+             (fun (alist-get choice mastodon-profile--account-view-alist
+                             nil nil #'equal)))
+        (funcall fun))
+    (cond ((mastodon-tl--buffer-type-eq 'profile-statuses)
+           (mastodon-profile--open-statuses-no-reblogs))
+          ((mastodon-tl--buffer-type-eq 'profile-statuses-no-boosts)
+           (mastodon-profile--open-statuses-no-replies))
+          ((mastodon-tl--buffer-type-eq 'profile-statuses-no-replies)
+           (mastodon-profile--open-statuses-only-media))
+          ((mastodon-tl--buffer-type-eq 'profile-statuses-only-media)
+           (mastodon-profile--open-followers))
+          ((mastodon-tl--buffer-type-eq 'profile-followers)
+           (mastodon-profile--open-following))
+          ((mastodon-tl--buffer-type-eq 'profile-following)
+           (mastodon-profile--open-statuses)))))
 
 (defun mastodon-profile--open-statuses ()
   "Open a profile showing statuses."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]