From 59e5e3ece54bcac36d9debad392bff25a31438b5 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 4 May 2023 09:12:23 +0200 Subject: updates to with-mastodon-buffer macro --- lisp/mastodon-toot.el | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'lisp/mastodon-toot.el') diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 9d44bfd..de6a5d4 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -902,30 +902,27 @@ instance to edit a toot." (interactive) (let ((id (mastodon-tl--property 'base-toot-id)) (history (mastodon-tl--property 'edit-history))) - (with-current-buffer (get-buffer-create "*mastodon-toot-edits*") - (let ((inhibit-read-only t)) - (special-mode) - (erase-buffer) - (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)) - (switch-to-buffer-other-window (current-buffer)) - (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))))) + (with-mastodon-buffer + "*mastodon-toot-edits*" #'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)))) (defun mastodon-toot--insert-toot-iter (it) "Insert iteration IT of toot." -- cgit v1.2.3