aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-transient.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@disroot.org>2024-10-24 10:45:20 +0200
committermarty hiatt <martianhiatus@disroot.org>2024-10-24 10:45:20 +0200
commit5a2fd200faa067a6c8fec087d9c99a0d7fab0415 (patch)
treec264a13198c6023ee6062f985b538b335da46886 /lisp/mastodon-transient.el
parent37a76491311fe1f6852be9ef6c683d3cbd1655a7 (diff)
transient poll: edit toot pulls in existing poll
Diffstat (limited to 'lisp/mastodon-transient.el')
-rw-r--r--lisp/mastodon-transient.el22
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el
index f418fcc..38da285 100644
--- a/lisp/mastodon-transient.el
+++ b/lisp/mastodon-transient.el
@@ -238,10 +238,10 @@ the format fields.X.keyname."
("e" "Expiry" "expiry" :alist-key expiry
:class mastodon-transient-expiry)]
["Choices"
- ("1" "" "1" :alist-key one :class tp-option-str)
- ("2" "" "2" :alist-key two :class tp-option-str)
- ("3" "" "3" :alist-key three :class tp-option-str)
- ("4" "" "4" :alist-key four :class tp-option-str)]
+ ("1" "" "1" :alist-key one :class mastodon-transient-poll-choice)
+ ("2" "" "2" :alist-key two :class mastodon-transient-poll-choice)
+ ("3" "" "3" :alist-key three :class mastodon-transient-poll-choice)
+ ("4" "" "4" :alist-key four :class mastodon-transient-poll-choice)]
;; TODO: display the max number of options or add options cmd
["Update"
("C-c C-c" "Save and done" mastodon-create-poll-done)
@@ -311,8 +311,18 @@ CONS is a cons of the form \"(fields.1.name . val)\"."
())
(cl-defmethod transient-init-value ((obj mastodon-transient-poll-bool))
+ "Initialize OBJ, a poll option.
+Pull value from `tp-transient-settings' if possible.'"
+ (let ((key (oref obj alist-key)))
+ (oset obj value
+ (alist-get key tp-transient-settings))))
+
+(defclass mastodon-transient-poll-choice (tp-option-str)
+ ())
+
+(cl-defmethod transient-init-value ((obj mastodon-transient-poll-choice))
"Initialize OBJ, an expiry option.
-Pull value from `mastodon-tool-poll' if possible.'"
+Pull value from `tp-transient-settings' if possible.'"
(let ((key (oref obj alist-key)))
(oset obj value
(alist-get key tp-transient-settings))))
@@ -322,7 +332,7 @@ Pull value from `mastodon-tool-poll' if possible.'"
(cl-defmethod transient-init-value ((obj mastodon-transient-expiry))
"Initialize OBJ, an expiry option.
-Pull value from `mastodon-tool-poll' if possible.'"
+Pull value from `tp-transient-settings' if possible.'"
(oset obj value
(alist-get 'expiry tp-transient-settings)))