emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mastodon 3303e85db9 11/45: display a POLL flag in compose


From: ELPA Syncer
Subject: [nongnu] elpa/mastodon 3303e85db9 11/45: display a POLL flag in compose buffer.
Date: Mon, 24 Jun 2024 10:01:50 -0400 (EDT)

branch: elpa/mastodon
commit 3303e85db950578d667bc686af7f866a60ba0ec1
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>

    display a POLL flag in compose buffer.
    
    next step: display/edit/cancel polls
---
 lisp/mastodon-toot.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index aaff19bb41..d21084b433 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]