diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-02 11:49:32 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-02 11:52:30 +0200 |
commit | d7e3ae509c77a1a168e4a811755444ae89f57466 (patch) | |
tree | 6aff24948ab0936db304c7f1b18380fd3d46a2eb | |
parent | a44f2363f6c74a91844b43a57e434646adc059c4 (diff) |
refactor format reply in compose str, propertize docs properly. FIX #448.
-rw-r--r-- | lisp/mastodon-toot.el | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 474337b..e77ddf3 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1415,6 +1415,19 @@ LONGEST is the length of the longest binding." longest-kbind) nil)))) +(defun mastodon-toot--format-reply-in-compose-string (reply-text) + "Format a REPLY-TEXT for display in compose buffer docs." + (let* ((rendered (mastodon-tl--render-text reply-text)) + (no-newlines (replace-regexp-in-string "\n\n" "\n" rendered))) + (concat " Reply to:\n\"" + ;; (propertize + (truncate-string-to-width + no-newlines + mastodon-toot-orig-in-reply-length) + ;; overridden by containing propertize call: + ;; 'face 'mastodon-toot-docs-reply-text-face) + "...\"\n"))) + (defun mastodon-toot--display-docs-and-status-fields (&optional reply-text) "Insert propertized text with documentation about `mastodon-toot-mode'. Also includes and the status fields which will get updated based @@ -1449,22 +1462,12 @@ REPLY-TEXT is the text of the toot being replied to." " Attachments: " (propertize "None " 'toot-attachments t) + "\n" + (if reply-text + (mastodon-toot--format-reply-in-compose-string reply-text) + "") + divider "\n") - 'face font-lock-comment-face - 'read-only "Edit your message below." - 'toot-post-header t) - (if reply-text - (concat - (propertize (truncate-string-to-width - (mastodon-tl--render-text reply-text) - mastodon-toot-orig-in-reply-length) - 'read-only "Edit your message below." - 'toot-post-header t - 'face '(variable-pitch :foreground "#7c6f64")) - "\n") - "") - (propertize - (concat divider "\n") 'rear-nonsticky t 'face font-lock-comment-face 'read-only "Edit your message below." |