branch: externals/vertico commit f584fe9c43069a58d326a5a62728316b83711976 Author: Jules Tamagnan <jtamag...@gmail.com> Commit: Daniel Mendler <m...@daniel-mendler.de>
Add an option to allow the vertico prompt to never be selected --- CHANGELOG.org | 5 +++++ vertico.el | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index d70d247899..66a2ed0ef4 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -2,6 +2,11 @@ #+author: Daniel Mendler #+language: en +* Development + +- =vertico-preselect=: Add =never-prompt= configuration choice to entirely disallow + the selection of the prompt. + * Version 1.7 (2024-01-23) - =vertico-buffer-mode=: Simplify mode line format. diff --git a/vertico.el b/vertico.el index 3ca1c42c74..e17753342a 100644 --- a/vertico.el +++ b/vertico.el @@ -66,9 +66,10 @@ (defcustom vertico-preselect 'directory "Configure if the prompt or first candidate is preselected. - prompt: Always select the prompt. -- first: Always select the first candidate. +- first: Select the first candidate, but allow prompt selection. +- never-prompt: Forbid selection of the prompt entirely. - directory: Like first, but select the prompt if it is a directory." - :type '(choice (const prompt) (const first) (const directory))) + :type '(choice (const prompt) (const first) (const directory) (const never-prompt))) (defcustom vertico-scroll-margin 2 "Number of lines at the top and bottom when scrolling. @@ -352,9 +353,10 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and PRED." (vertico--candidates . ,all) (vertico--total . ,(length all)) (vertico--hilit . ,(or hl #'identity)) - (vertico--allow-prompt . ,(or def-missing (eq vertico-preselect 'prompt) - (memq minibuffer--require-match - '(nil confirm confirm-after-completion)))) + (vertico--allow-prompt . ,(and (not (eq vertico-preselect 'never-prompt)) + (or def-missing (eq vertico-preselect 'prompt) + (memq minibuffer--require-match + '(nil confirm confirm-after-completion))))) (vertico--lock-candidate . ,lock) (vertico--groups . ,(cadr groups)) (vertico--all-groups . ,(or (caddr groups) vertico--all-groups))