diff options
-rw-r--r-- | lisp/mastodon-tl.el | 16 | ||||
-rw-r--r-- | lisp/mastodon.el | 17 |
2 files changed, 15 insertions, 18 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index cef995d..31c73a2 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -42,7 +42,6 @@ (autoload 'mastodon-mode "mastodon") (autoload 'mastodon-notifications-get "mastodon") (autoload 'mastodon-url-lookup "mastodon") -(autoload 'with-mastodon-buffer "mastodon") (autoload 'mastodon-auth--get-account-id "mastodon-auth") (autoload 'mastodon-auth--get-account-name "mastodon-auth") (autoload 'mastodon-http--api "mastodon-http") @@ -258,6 +257,21 @@ types of mastodon links and not just shr.el-generated ones.") It is active where point is placed by `mastodon-tl--goto-next-toot.'") +;;; MACRO +(defmacro with-mastodon-buffer (buffer &rest body) + "Evaluate BODY in a new or existing buffer called BUFFER. +MODE-FUN is called to set the major mode. +OTHER-WINDOW means call `switch-to-buffer-other-window' rather +than `switch-to-buffer'." + (declare (debug t) + (indent defun)) + `(with-current-buffer (get-buffer-create ,buffer) + (let ((inhibit-read-only t)) + (erase-buffer) + (switch-to-buffer ,buffer) + ,@body))) + + ;;; NAV (defun mastodon-tl--next-tab-item () diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 1fcb234..e181786 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -256,23 +256,6 @@ 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 mode-fun other-window &rest body) - "Evaluate BODY in a new or existing buffer called BUFFER. -MODE-FUN is called to set the major mode. -OTHER-WINDOW means call `switch-to-buffer-other-window' rather -than `switch-to-buffer'." - (declare (debug t) - (indent defun)) - `(with-current-buffer (get-buffer-create ,buffer) - (let ((inhibit-read-only t)) - (erase-buffer) - (if ,other-window - (switch-to-buffer-other-window ,buffer) - (switch-to-buffer ,buffer)) - (funcall ,mode-fun) - ,@body))) - - ;;;###autoload (defun mastodon () "Connect Mastodon client to `mastodon-instance-url' instance." |