aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-06 15:30:53 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-06 15:46:29 +0200
commitacde8c11694298a734da97be490856c025a96db8 (patch)
tree69de637a9cbc5b1554b7d7782c3d84bcb330b421 /lisp/mastodon-tl.el
parent4a4eaa48557c50c393af2a0b499023fad4474a24 (diff)
move with-masto-buffer to -tl.el
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el16
1 files changed, 15 insertions, 1 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 ()