diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-06-02 17:25:38 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-06-02 17:25:38 +0200 |
commit | 3303e85db950578d667bc686af7f866a60ba0ec1 (patch) | |
tree | af2e6e3f1294afa64ced7d21f1cce6cf7f7b9934 /lisp | |
parent | 4aad54dcdff670f38bc0ba5891bca43d679ca46c (diff) |
display a POLL flag in compose buffer.
next step: display/edit/cancel polls
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-toot.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index aaff19b..d21084b 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1387,7 +1387,8 @@ MAX is the maximum number set by their instance." (setq mastodon-toot-poll `(:options ,options :length ,length :multi ,multiple-p :hide ,hide-totals :expiry ,expiry)) - (message "poll created!"))) + (message "poll created!") + (mastodon-toot--update-status-fields))) (defun mastodon-toot--read-poll-options (count length) "Read a list of options for poll with COUNT options. @@ -1609,6 +1610,9 @@ REPLY-TEXT is the text of the toot being replied to." (propertize "CW" 'toot-post-cw-flag t) " " + (propertize "POLL" + 'toot-post-poll-flag t) + " " (propertize "NSFW" 'toot-post-nsfw-flag t) "\n" @@ -1700,6 +1704,8 @@ REPLY-REGION is a string to be injected into the buffer." (point-min))) (scheduled-region (mastodon-tl--find-property-range 'toot-post-scheduled (point-min))) + (poll-region (mastodon-tl--find-property-range 'toot-post-poll-flag + (point-min))) (toot-string (buffer-substring-no-properties (cdr header-region) (point-max)))) (add-text-properties (car count-region) (cdr count-region) @@ -1731,11 +1737,16 @@ REPLY-REGION is a string to be injected into the buffer." (add-text-properties (car nsfw-region) (cdr nsfw-region) (list 'display (if mastodon-toot--content-nsfw (if mastodon-toot--media-attachments - "NSFW" "NSFW (for attachments only)") + "NSFW" "NSFW (attachments only)") "") 'face 'mastodon-cw-face)) + (add-text-properties (car poll-region) (cdr poll-region) + (list 'display (if mastodon-toot-poll "POLL" "") + 'face 'mastodon-cw-face)) (add-text-properties (car cw-region) (cdr cw-region) - (list 'invisible (not mastodon-toot--content-warning) + (list 'display (if mastodon-toot--content-warning + "CW" + " ") ;; hold the blank space 'face 'mastodon-cw-face))))) (defun mastodon-toot--count-toot-chars (toot-string &optional cw) |