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

    transient: subclass for notifs policy opts
---
 lisp/mastodon-transient.el | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el
index bad2974292..536c0362e0 100644
--- a/lisp/mastodon-transient.el
+++ b/lisp/mastodon-transient.el
@@ -348,24 +348,16 @@ Do not add more than the server's maximum setting."
   ;; https://docs.joinmastodon.org/methods/notifications/#get-policy
   :value (lambda () (tp-return-data #'mastodon-notifications--get-policy))
   ["Notification policy options"
-   ;; FIXME: it would be nice to display our three options and cycle, but
-   ;; tp-bool no longer works that way so we would have to implement
-   ;; subclasses / methods:
    ("f" "for not following" "for_not_following"
-    :alist-key for_not_following :class tp-cycle
-    :choices (lambda () mastodon-notifications-policy-vals))
+    :alist-key for_not_following :class mastodon-transient-policy)
    ("F" "for not followers" "for_not_followers"
-    :alist-key for_not_followers :class tp-cycle
-    :choices (lambda () mastodon-notifications-policy-vals))
+    :alist-key for_not_followers :class mastodon-transient-policy)
    ("n" "for new accounts" "for_new_accounts"
-    :alist-key for_new_accounts :class tp-cycle
-    :choices (lambda () mastodon-notifications-policy-vals))
+    :alist-key for_new_accounts :class mastodon-transient-policy)
    ("p" "for private mentions" "for_private_mentions"
-    :alist-key for_private_mentions :class tp-cycle
-    :choices (lambda () mastodon-notifications-policy-vals))
+    :alist-key for_private_mentions :class mastodon-transient-policy)
    ("l" "for limited accounts" "for_limited_accounts"
-    :alist-key for_limited_accounts :class tp-cycle
-    :choices (lambda () mastodon-notifications-policy-vals))]
+    :alist-key for_limited_accounts :class mastodon-transient-policy)]
   ["Update"
    ("C-c C-c" "Save settings" ;; mastodon-transient--prefix-inspect)
     mastodon-notifications-policy-update)
@@ -385,6 +377,10 @@ Do not add more than the server's maximum setting."
 
 ;;; CLASSES
 
+(defclass mastodon-transient-policy (tp-cycle)
+  ((choices :initarg :choices :initform mastodon-notifications-policy-vals))
+  "")
+
 (defclass mastodon-transient-field (tp-option-str)
   ((always-read :initarg :always-read :initform t))
   "An infix option class for our options.

Reply via email to