aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-16 08:59:48 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-16 09:29:31 +0100
commit1d3f82da36a8734e5489662fc8b4a4de0de811bb (patch)
tree81e7d9c39bf0b491dd8bf8ab41d249ac11d5c0eb
parent247a2e71eed80ed3d09d1e3eba90b306c6aeb347 (diff)
mastodon-live-buffers / mastodon-kill-all-buffers
-rw-r--r--lisp/mastodon.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index cd7dd8e..ff9888e 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -204,6 +204,7 @@ Use. e.g. \"%c\" for your locale's date and time format."
(define-key map (kbd "E") #'mastodon-toot--view-toot-edits)
(when (require 'lingva nil :no-error)
(define-key map (kbd "s") #'mastodon-toot--translate-toot-text))
+ (define-key map (kbd "M-C-q") #'mastodon-kill-all-buffers)
map)
"Keymap for `mastodon-mode'.")
@@ -345,6 +346,20 @@ not, just browse the URL in the normal fashion."
(string-match "^/[[:alpha:]]+$" query)
(string-match "^/u/[[:alpha:]]+$" query)))))
+(defun mastodon-live-buffers ()
+ "Return a list of open mastodon buffers.
+Calls `mastodon-tl--get-buffer-type', which see."
+ (cl-loop for x in (buffer-list)
+ when (with-current-buffer x (mastodon-tl--get-buffer-type))
+ collect (get-buffer x)))
+
+(defun mastodon-kill-all-buffers ()
+ "Kill any and all open mastodon buffers, hopefully."
+ (interactive)
+ (let ((mastodon-buffers (mastodon-live-buffers)))
+ (cl-loop for x in mastodon-buffers
+ do (kill-buffer x))))
+
;;;###autoload
(add-hook 'mastodon-mode-hook (lambda ()
(when (require 'emojify nil :noerror)