diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-16 08:59:48 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-16 09:29:31 +0100 |
commit | 1d3f82da36a8734e5489662fc8b4a4de0de811bb (patch) | |
tree | 81e7d9c39bf0b491dd8bf8ab41d249ac11d5c0eb | |
parent | 247a2e71eed80ed3d09d1e3eba90b306c6aeb347 (diff) |
mastodon-live-buffers / mastodon-kill-all-buffers
-rw-r--r-- | lisp/mastodon.el | 15 |
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) |