From: Tassilo Horn <tsdh@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Completion: display of candidates
Date: Mon, 18 Feb 2019 20:24:30 +0100 [thread overview]
Message-ID: <877edwsxw1.fsf@gnu.org> (raw)
In-Reply-To: <jwvtvh1dm0a.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 18 Feb 2019 13:05:14 -0500")
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>> 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.
Right, and here comes the next problem: concretely I get my completions
from `locate --basename <pattern>`. So the user (me) might enter a
wildcard pattern like "foo*bar.*". But the completions/matches
obviously have no * in it, so no completion matches the candidates.
How to handle that? Use the PREDICATE argument in completing-read so
that the input ".em*s" matches the found candidate ".emacs (/home/horn)"
by transforming the wildcard to an emacs regexp and using
string-match-p?
> 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).
I'll have a look at it. Thanks for the pointer.
>> 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.
I use the REQUIRE-MATCH argument of completing read, and even if I
didn't, if there's no property the user (me) must have entered a file
name then.
Bye,
Tassilo
next prev parent reply other threads:[~2019-02-18 19:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 7:54 Completion: display of candidates Tassilo Horn
2019-02-18 13:26 ` Stefan Monnier
2019-02-18 14:55 ` Tassilo Horn
2019-02-18 18:05 ` Stefan Monnier
2019-02-18 19:24 ` Tassilo Horn [this message]
2019-02-18 20:48 ` Stefan Monnier
2019-02-19 7:27 ` Tassilo Horn
2019-02-19 15:28 ` Stefan Monnier
[not found] ` <87imxe1pfs.fsf@gnu.org>
2019-02-20 16:54 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877edwsxw1.fsf@gnu.org \
--to=tsdh@gnu.org \
--cc=help-gnu-emacs@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).