From 6a5152b6cbbf69c46720732a847ca47504bf213f Mon Sep 17 00:00:00 2001 From: Rahguzar Date: Sat, 6 Jan 2024 12:54:27 +0100 Subject: Use 'read-buffer' to choose a buffer --- lisp/mastodon.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lisp') 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 () -- cgit v1.2.3