diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-08-02 18:53:09 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-08-02 18:53:09 +0200 |
commit | 1c1085a321a0885431e7eac5f720b6b0bedd797e (patch) | |
tree | 3407b55ecc9aba4ed6b8ce4b117ed1fea21094ae /lisp/mastodon-toot.el | |
parent | dcf0747052ce07a368292fd45f75b21502fded90 (diff) |
toot: re-write view-toot-edits
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r-- | lisp/mastodon-toot.el | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 00f7ce7..166f08b 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -975,28 +975,29 @@ instance to edit a toot." "View editing history of the toot at point in a popup buffer." (interactive) (let ((id (mastodon-tl--property 'base-item-id)) - (history (mastodon-tl--property 'edit-history)) + (history (mastodon-tl--property 'edit-history)) ;; at byline (buf "*mastodon-toot-edits*")) - (with-mastodon-buffer buf #'special-mode :other-window - (let ((count 1)) - (mapc (lambda (x) - (insert (propertize (if (= count 1) - (format "%s [original]:\n" count) - (format "%s:\n" count)) - 'face 'font-lock-comment-face) - (mastodon-toot--insert-toot-iter x) - "\n") - (cl-incf count)) - history)) - (setq-local header-line-format - (propertize - (format "Edits to toot by %s:" - (alist-get 'username - (alist-get 'account (car history)))) - 'face 'font-lock-comment-face)) - (mastodon-tl--set-buffer-spec (buffer-name (current-buffer)) - (format "statuses/%s/history" id) - nil)))) + (if (not history) + (user-error "No editing history for this toot") + (with-mastodon-buffer buf #'special-mode :other-window + (cl-loop for count from 1 + for x in history + do (insert (propertize (if (= count 1) + (format "%s [original]:\n" count) + (format "%s:\n" count)) + 'face 'font-lock-comment-face) + (mastodon-toot--insert-toot-iter x) + "\n")) + (goto-char (point-min)) + (setq-local header-line-format + (propertize + (format "Edits to toot by %s:" + (alist-get 'username + (alist-get 'account (car history)))) + 'face 'font-lock-comment-face)) + (mastodon-tl--set-buffer-spec (buffer-name (current-buffer)) + (format "statuses/%s/history" id) + nil))))) (defun mastodon-toot--insert-toot-iter (it) "Insert iteration IT of toot." |