help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Completion: display of candidates


From: Stefan Monnier
Subject: Re: Completion: display of candidates
Date: Mon, 18 Feb 2019 13:05:14 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>> 1. The docs for completion-table-dynamic say that the given function
>>>    should return an alist
>> That's an error: the return value should be a completion table.
> So a "list of strings or cons cells, an obarray, a hash table, or a
> completion function".

Right.  With the caveat that this function will not be consulted for
`completion-metadata` and `completion-boundaries` queries.

I just pushed a corresponding patch to `emacs-26`.

> When you know what to look for, you'll find it
> (in the info docs for try-completion).

It should also be described in `(elisp)Programmed Completion', as
suggested in the docstring.

> Yes, I could.  I just thought that there's probably some kind of
> metadata I could attach for customizing the display.

It can't be "display only" since the user expects to type what is
displayed, so it also affects what the user types.

BTW, you might be interested in the GNU ELPA package `uniquify-files`
which tries to do almost exactly what you suggest (it requires a few
ugly hacks currently, but we hope to be able to improve the
minibuffer.el infrastructure so those can be dispensed with).

> So I guess the best thing to do is to format the entries as you suggest
> and put a text property on the text holding the absolute path so that I
> don't have to reconstruct it myself which could be error-prone if the
> directory or basename contain parens themselves.

You can't really rely on those text-properties, because the user may
have typed that text by hand.


        Stefan



reply via email to

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