diff options
author | Rahguzar <rahguzar@zohomail.eu> | 2024-01-06 12:54:27 +0100 |
---|---|---|
committer | Rahguzar <rahguzar@zohomail.eu> | 2024-01-07 10:38:24 +0100 |
commit | 6a5152b6cbbf69c46720732a847ca47504bf213f (patch) | |
tree | 9a90609eefc3f19c30fa61412b7f8f67722d0eda | |
parent | 445d176b2a593a87afd3f6bca717feba639dfbdc (diff) |
Use 'read-buffer' to choose a buffer
-rw-r--r-- | lisp/mastodon.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el index c9c3b64..2ab3bc3 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -433,10 +433,12 @@ Calls `mastodon-tl--get-buffer-type', which see." (defun mastodon-switch-to-buffer () "Switch to a live mastodon buffer." (interactive) - (let* ((bufs (mastodon-live-buffers)) - (buf-names (mapcar #'buffer-name bufs)) - (choice (completing-read "Switch to mastodon buffer: " - buf-names))) + (let ((choice (read-buffer + "Switch to mastodon buffer: " nil t + (lambda (cand) + (with-current-buffer + (if (stringp cand) cand (car cand)) + (mastodon-tl--get-buffer-type)))))) (switch-to-buffer choice))) (defun mastodon-mode-hook-fun () |