diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-03 21:29:27 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-03 21:29:27 +0200 |
commit | 51f8b782ac6721939e20eca459fe88eb4304857c (patch) | |
tree | f8ac598267cc26859b7b48951000f39e2c3683b6 /lisp/mastodon.el | |
parent | 718a12d2fc9c16f839735a8e238a01f3174be52e (diff) |
with-mastodon-buffer macro
Diffstat (limited to 'lisp/mastodon.el')
-rw-r--r-- | lisp/mastodon.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 722e927..fca376d 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -255,6 +255,16 @@ mastodon.el needs to be re-loaded for this to be correctly set.") "Face used for reply text in toot compose buffer. See `mastodon-toot-display-orig-in-reply-buffer'.") +(defmacro with-mastodon-buffer (buffer &rest body) + "Evaluate BODY in a new `mastodon-mode' buffer called BUFFER." + (declare (debug 'body)) + `(with-current-buffer (get-buffer-create ,buffer) + (let ((inhibit-read-only t)) + (erase-buffer) + (switch-to-buffer ,buffer) + (mastodon-mode) + ,@body))) + ;;;###autoload (defun mastodon () "Connect Mastodon client to `mastodon-instance-url' instance." |