diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-23 22:08:10 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-23 22:09:00 +0200 |
commit | b16a09f9b488098b818ac68c10a9a199db215d46 (patch) | |
tree | 2fc571c3fc6a9bdbce1cc33a60d78d7ebe806d9c | |
parent | e0a69c9b25224b9dadb6c533c188de34673245d6 (diff) |
move list call in tl--read-poll-option
-rw-r--r-- | lisp/mastodon-tl.el | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 6f9a985..0977475 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1148,27 +1148,27 @@ LONGEST-OPTION is the option whose length determines the formatting." (defun mastodon-tl--read-poll-option () "Read a poll option to vote on a poll." - (list (let* ((toot (mastodon-tl--property 'toot-json)) - (poll (mastodon-tl--field 'poll toot)) - (options (mastodon-tl--field 'options poll)) - (options-titles (mastodon-tl--map-alist 'title options)) - (options-number-seq (number-sequence 1 (length options))) - (options-numbers (mapcar #'number-to-string options-number-seq)) - (options-alist (cl-mapcar #'cons options-numbers options-titles)) - ;; we display both option number and the option title - ;; but also store both as cons cell as cdr, as we need it below - (candidates (mapcar (lambda (cell) - (cons (format "%s | %s" (car cell) (cdr cell)) - cell)) - options-alist))) - (if (null poll) - (message "No poll here.") - ;; var "option" = just the cdr, a cons of option number and desc - (cdr (assoc (completing-read "Poll option to vote for: " - candidates - nil - t) ; require match - candidates)))))) + (let* ((toot (mastodon-tl--property 'toot-json)) + (poll (mastodon-tl--field 'poll toot)) + (options (mastodon-tl--field 'options poll)) + (options-titles (mastodon-tl--map-alist 'title options)) + (options-number-seq (number-sequence 1 (length options))) + (options-numbers (mapcar #'number-to-string options-number-seq)) + (options-alist (cl-mapcar #'cons options-numbers options-titles)) + ;; we display both option number and the option title + ;; but also store both as cons cell as cdr, as we need it below + (candidates (mapcar (lambda (cell) + (cons (format "%s | %s" (car cell) (cdr cell)) + cell)) + options-alist))) + (if (null poll) + (message "No poll here.") + (list + ;; var "option" = just the cdr, a cons of option number and desc + (cdr (assoc (completing-read "Poll option to vote for: " + candidates + nil t) ; require match + candidates)))))) (defun mastodon-tl--poll-vote (option) "If there is a poll at point, prompt user for OPTION to vote on it." |