From 97bd086e4c2269bf6cfe453675bbf7f1210b5355 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 29 Mar 2023 13:37:48 +0200 Subject: user-handles-get: return immediately if only one candidate FIX #420. --- lisp/mastodon-tl.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index c929502..60ebc80 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1920,13 +1920,16 @@ LANGS is the accumulated array param alist if we re-run recursively." (t (mastodon-profile--extract-users-handles (mastodon-profile--toot-json)))))) - (completing-read (if (or (equal action "disable") - (equal action "enable")) - (format "%s notifications when user posts: " action) - (format "Handle of user to %s: " action)) - user-handles - nil ; predicate - 'confirm)))) + ;; return immediately if only 1 handle: + (if (eq 1 (length user-handles)) + (car user-handles) + (completing-read (if (or (equal action "disable") + (equal action "enable")) + (format "%s notifications when user posts: " action) + (format "Handle of user to %s: " action)) + user-handles + nil ; predicate + 'confirm))))) (defun mastodon-tl--interactive-blocks-or-mutes-list-get (action) "Fetch the list of accounts for ACTION from the server. -- cgit v1.2.3