emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vertico 54c8f7362c: vertico-insert: Always insert first


From: ELPA Syncer
Subject: [elpa] externals/vertico 54c8f7362c: vertico-insert: Always insert first candidate, if prompt is selected
Date: Wed, 14 Sep 2022 02:58:21 -0400 (EDT)

branch: externals/vertico
commit 54c8f7362cc8a6e5927186f704e9946a632c7e14
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    vertico-insert: Always insert first candidate, if prompt is selected
    
    I just tagged a stable release, so we can safely try a new behavior for a 
while.
    The condition gets simpler, that's great. ;) Possible downside is that the
    behavior may lead to accidental insertion of the first candidate even if the
    candidate is not preferred.
    
    By always inserting the first candidate one can repeatedly navigate 
directory
    hierarchies as long as the completion candidates are sorted by
    `vertico-sort-history-length-alpha`. `savehist-mode` remembers the history 
of
    recent candidates across Emacs restarts. An alternative is the Prescient 
package
    which sorts by frecency and which can also persist the selection history.
    
    To give more context, there are multiple reasonable possibilities for
    `vertico-insert` if the prompt line is selected:
    
    - Use `completion-try-completion` to expand. This behavior is used by 
default
      completion or by my Corfu in-buffer completion package.
    - Ignore TAB (old behavior, before #242)
    - If there is only a single candidate, insert it (before this commit)
    - If there is at least one candidate, insert first candidate (this commit)
    
    See #272 and #237 for discussion. cc @raxod502
---
 vertico.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vertico.el b/vertico.el
index a60608d3a8..879a9e781a 100644
--- a/vertico.el
+++ b/vertico.el
@@ -720,7 +720,7 @@ When the prefix argument is 0, the group order is reset."
   ;; candidate only includes the prefix "~/emacs/master/lisp/", but not the
   ;; suffix "/calc". Default completion has the same problem when selecting in
   ;; the *Completions* buffer. See bug#48356.
-  (when (or (>= vertico--index 0) (= vertico--total 1))
+  (when (> vertico--total 0)
     (let ((vertico--index (max 0 vertico--index)))
       (insert (prog1 (vertico--candidate) (delete-minibuffer-contents))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]