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: Tassilo Horn
Subject: Re: Completion: display of candidates
Date: Mon, 18 Feb 2019 15:55:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 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".  When you know what to look for, you'll find it
(in the info docs for try-completion).

>> 2. Is there a way to display and complete on a different representation
>>    than the actual completion candidates?  In my case, my-func returns
>>    absolute file names but I'd like to complete on just the basename,
>>    and display the entries in the form of "basename (directory)".
>
> You can modify `my-func` to return file names in the form
> "basename (directory)", no?

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

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.

Bye,
Tassilo



reply via email to

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