From f1bdef0b734fef63aeb4854b2a87503d442bd4ec Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 2 Nov 2024 10:49:18 +0100 Subject: revert transient polls to use mastodon-toot-poll internally, the transients still use tp-transient-settings, but they fetch from mastodon-toot-poll, and set it when done. we also hack around so that the cancelling functions work ok. --- lisp/mastodon-transient.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lisp/mastodon-transient.el') diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el index c96e1d5..6b1296f 100644 --- a/lisp/mastodon-transient.el +++ b/lisp/mastodon-transient.el @@ -268,8 +268,12 @@ Do not add more than the server's maximum setting." (transient-define-prefix mastodon-create-poll () "A transient for creating a poll." - ;; FIXME: handle existing polls when editing a toot - :value (lambda () tp-transient-settings) + :value (lambda () + ;; we set `tp-transient-settings' here to the poll value poss + ;; pulled from the server by + ;; `mastodon-toot--server-poll-to-local'. when we are done with + ;; the transient, we set `mastodon-toot-poll' again + (setq tp-transient-settings mastodon-toot-poll)) ["Create poll" (:info (lambda () (format "Max options: %s" @@ -305,7 +309,7 @@ Do not add more than the server's maximum setting." "Clear current poll data." :transient 'transient--do-stay (interactive) - (mastodon-toot--clear-poll) + (mastodon-toot--clear-poll :transient) (transient-reset)) (transient-define-suffix mastodon-create-poll-done (args) @@ -335,7 +339,9 @@ Do not add more than the server's maximum setting." (call-interactively #'mastodon-create-poll) ;; if we are called with no poll data, do not set: (unless (not vals) - (setq tp-transient-settings + ;; we set `mastodon-toot-poll' here not `tp-transient-settings' + ;; as that is our var outside of our transient: + (setq mastodon-toot-poll (tp-bools-to-strs args))) (mastodon-toot--update-status-fields)))) -- cgit v1.2.3 From 9eaf125207099ea78ec216b1622244930f14659d Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 2 Nov 2024 15:45:37 +0100 Subject: docstring poll done --- lisp/mastodon-transient.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/mastodon-transient.el') diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el index 6b1296f..3e8ba5f 100644 --- a/lisp/mastodon-transient.el +++ b/lisp/mastodon-transient.el @@ -313,7 +313,7 @@ Do not add more than the server's maximum setting." (transient-reset)) (transient-define-suffix mastodon-create-poll-done (args) - "Update current user profile fields." + "Finish setting poll details." :transient 'transient--do-exit (interactive (list (transient-args 'mastodon-create-poll))) (let* ((options (cl-member-if (lambda (x) -- cgit v1.2.3