[Top][All Lists]

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

Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package

From: Dmitry Gutov
Subject: Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package: vertico
Date: Sat, 10 Apr 2021 04:56:52 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 10.04.2021 02:48, Stefan Monnier wrote:
Mind you, I generally prefer completion UIs that show the options before you
start typing, but xref-show-definitions-completing-read makes a really
strong case for it. Which is unfortunate, because otherwise it's my #1
choice for xref-show-definitions-function's default value, and changing
Emacs's completion UI is not in the cards in any near future.

So I would only be happy if you disagree with this assessment.

I think it would be desirable to change the default UI just enough so
that a code like Xref can make `completing-read` display the
completions eagerly.

The *Completions* window, you mean? It would still miss the ability to quickly accept one of them with RET.

One thing we can already do is to make Xref use a completion category
with an entry in `completion-category-defaults` which specifies a value
of t for `completion-cycle-threshold`.  This way a simple TAB should
select the first entry.

The result is... interesting. Not my first choice of the UI, but it does improve on the issue I mentioned above (while missing the ability to look at all options at once, which is particularly useful for the function is question).

Does anybody feel like it's an improvement enough to make xref-show-definitions-completing-read a viable default?

Here's the patch to try (though we might want to replace t with a number like 4):

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 5f594679ca..0ba55916c9 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -957,7 +957,8 @@ completion-category-defaults
     ;; A new style that combines substring and pcm might be better,
     ;; e.g. one that does not anchor to bos.
     (project-file (styles . (substring)))
-    (xref-location (styles . (substring)))
+    (xref-location . ((styles . (substring))
+                      (cycle . t)))
     (info-menu (styles . (basic substring))))
   "Default settings for specific completion categories.
 Each entry has the shape (CATEGORY . ALIST) where ALIST is

reply via email to

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