aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@disroot.org>2024-10-23 21:29:41 +0200
committermarty hiatt <martianhiatus@disroot.org>2024-10-23 21:29:41 +0200
commit7c9e5577f77da54d10bc0ed1426f0eff3570e3de (patch)
tree2e1c6cc8826097c7a941e4b3dbd6ed16b0b78c38
parent263d486c3bb83bc7cbfb9bb5196f25f1253c02a5 (diff)
boolean defcustom for transient poll
-rw-r--r--lisp/mastodon-toot.el10
-rw-r--r--lisp/mastodon-transient.el6
2 files changed, 13 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 4177062..efcbc72 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -168,6 +168,10 @@ By default fixed width fonts are used."
:type '(boolean :tag "Enable using proportional rather than fixed \
width fonts"))
+(defcustom mastodon-toot-poll-use-transient t
+ "Whether to use the transient menu to create a poll."
+ :type '(boolean))
+
(defvar-local mastodon-toot--content-warning nil
"The content warning of the current toot.")
@@ -1401,6 +1405,12 @@ MAX is the maximum number set by their instance."
(defun mastodon-toot--create-poll ()
"Prompt for new poll options and return as a list."
(interactive)
+ (if mastodon-toot-poll-use-transient
+ (mastodon-create-poll)
+ (mastodon-toot--read-poll)))
+
+(defun mastodon-toot--read-poll ()
+ "Read poll options."
(let* ((instance (mastodon-instance-data))
(max-options (mastodon-toot--fetch-max-poll-options instance))
(count (mastodon-toot--read-poll-options-count max-options))
diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el
index 1a9442e..fbdfcb0 100644
--- a/lisp/mastodon-transient.el
+++ b/lisp/mastodon-transient.el
@@ -217,7 +217,7 @@ the format fields.X.keyname."
(let ((instance (mastodon-instance-data)))
(mastodon-toot--fetch-max-poll-option-chars instance)))
-(transient-define-prefix mastodon-toot--create-poll ()
+(transient-define-prefix mastodon-create-poll ()
"A transient for creating a poll."
;; FIXME: handle existing polls when editing a toot
;; FIXME: handle editing poll in same toot!
@@ -245,12 +245,12 @@ the format fields.X.keyname."
(interactive)
(if (not mastodon-active-user)
(user-error "User not set")
- (transient-setup 'mastodon-toot--create-poll)))
+ (transient-setup 'mastodon-create-poll)))
(transient-define-suffix mastodon-create-poll-done (args)
"Update current user profile fields."
:transient 'transient--do-exit
- (interactive (list (transient-args 'mastodon-toot--create-poll)))
+ (interactive (list (transient-args 'mastodon-create-poll)))
;; (message "Done!\n%s" args)
;; this is a mess, but we are just plugging our transient data into the
;; existing variable, as we already have code to post that. we don't