branch: elpa/mastodon
commit 2fcf70edf75ce1cd0b61b6c8a8ef53927983c165
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    basic render quoted status.
    
    move quote to after toot (WIP)
---
 lisp/mastodon-tl.el | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 72c6d8fcf76..3e699acf8bd 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1890,6 +1890,19 @@ Runs `mastodon-tl--render-text' and fetches poll or 
media."
           (goto-char (prop-match-end prop)))))
     list))
 
+(defun mastodon-tl--insert-quoted (data)
+  "Propertize quoted status DATA for insertion."
+  (let ((bar (concat " " (mastodon-tl--symbol 'reply-bar)))
+        (content (map-nested-elt data '(quoted_status content))))
+    (propertize
+     (concat
+      (mastodon-tl--byline (alist-get 'quoted_status data))
+      (mastodon-tl--render-text content
+                                (alist-get 'quoted_status data)))
+     'line-prefix bar
+     'wrap-prefix bar
+     'mastodon-quote data)))
+
 (defun mastodon-tl--insert-status
     (toot body &optional detailed-p thread domain unfolded no-byline
           cw-expanded)
@@ -1913,7 +1926,8 @@ CW-EXPANDED means treat content warnings as unfolded."
          (cw-p (not
                 (string-empty-p
                  (alist-get 'spoiler_text toot))))
-         (body-tags (mastodon-tl--body-tags body)))
+         (body-tags (mastodon-tl--body-tags body))
+         (quote (alist-get 'quote toot)))
     (insert
      (propertize ;; body + byline:
       (concat
@@ -1930,11 +1944,17 @@ CW-EXPANDED means treat content warnings as unfolded."
                (body (if (and toot-foldable (not unfolded))
                          (mastodon-tl--fold-body body)
                        body)))
-           (if (and after-reply-status-p thread)
-               (propertize body
-                           'line-prefix bar
-                           'wrap-prefix bar)
-             body))
+           (concat
+            ;; insert quote maybe:
+            (if (and after-reply-status-p thread)
+                (propertize body
+                            'line-prefix bar
+                            'wrap-prefix bar)
+              body)
+            (when quote
+              (concat "\n\n"
+                      (mastodon-tl--insert-quoted quote)
+                      ))))
          (if (and toot-foldable unfolded cw-expanded)
              (mastodon-tl--read-more-or-less
               "LESS" cw-p (not cw-expanded))

Reply via email to