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

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

[nongnu] elpa/mastodon e9f77777dd 11/18: add cycle notif function. FIX #


From: ELPA Syncer
Subject: [nongnu] elpa/mastodon e9f77777dd 11/18: add cycle notif function. FIX #628.
Date: Mon, 2 Dec 2024 16:00:34 -0500 (EST)

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

    add cycle notif function. FIX #628.
---
 lisp/mastodon-notifications.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index c302db0e22..6a67fa8e24 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -83,7 +83,7 @@
   "A list of notification types according to their name on the server, plus 
\"all\".")
 
 (defvar mastodon-notifications--filter-types-alist
-  '(("all"                    . mastodon-notifications--get)
+  '(("all"                    . mastodon-notifications-get)
     ("favourite"              . mastodon-notifications--get-favourites)
     ("reblog"                 . mastodon-notifications--get-boosts)
     ("mention"                . mastodon-notifications--get-mentions)
@@ -112,6 +112,7 @@ Notification types are named according to their name on the 
server.")
     (define-key map (kbd "a") #'mastodon-notifications--follow-request-accept)
     (define-key map (kbd "j") #'mastodon-notifications--follow-request-reject)
     (define-key map (kbd "C-k") #'mastodon-notifications--clear-current)
+    (define-key map (kbd "C-c C-c") #'mastodon-notifications--cycle-type)
     map)
   "Keymap for viewing notifications.")
 
@@ -503,7 +504,8 @@ NO-GROUP means don't render grouped notifications."
      :newline)
     (insert "\n")
     (mastodon-notifications--render json (not mastodon-group-notifications))
-    (goto-char (point-min))))
+    (goto-char (point-min))
+    (mastodon-tl--goto-next-item)))
 
 (defun mastodon-notifications--get-type (&optional type)
   "Read a notification type and load its timeline."
@@ -516,6 +518,20 @@ NO-GROUP means don't render grouped notifications."
               choice mastodon-notifications--filter-types-alist
               nil nil #'equal))))
 
+(defun mastodon-notifications--cycle-type ()
+  "Cycle the current notifications view."
+  (interactive)
+  (let* ((update-params (mastodon-tl--buffer-property
+                         'update-params nil :no-error))
+         (type (alist-get "types[]" update-params nil nil #'equal))
+         (next (if (not update-params)
+                   (cadr mastodon-notifications--types)
+                 (or (cadr (member type mastodon-notifications--types))
+                     (car mastodon-notifications--types))))
+         (fun (alist-get next mastodon-notifications--filter-types-alist
+                         nil nil #'equal)))
+    (funcall fun)))
+
 (defun mastodon-notifications--get-mentions ()
   "Display mention notifications in buffer."
   (interactive)



reply via email to

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