emacs-devel
[Top][All Lists]
Advanced

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

Re: make project--find-in-file generic, add interactive filename to proj


From: Stefan Monnier
Subject: Re: make project--find-in-file generic, add interactive filename to project-find-file
Date: Thu, 28 Jan 2016 08:14:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>>> - IIRC, using INITIAL-INPUT argument is semi-deprecated. Using DEFAULT
>>> is preferable,
>> I was not aware of M-n (more below).
> Hmm, the default value actually has one noticeable drawback here: if you
> just press RET, completing-read will accept it, and won't check whether the
> completion table includes the given value.  Then, find-file will be called
> with this raw (not expanded) value.
> Stefan, would you say INITIAL-INPUT is better for this use case?

Details of whether completing-read checks the validity of DEFAULT
against the completion table shouldn't determine whether we use DEFAULT
or INITIAL-INPUT.  After all, if we want it to be checked, we can
perform that check manually.

>> However, the default still does not show anywhere;
>> we should add it to the prompt.
> Agree.  If we end up using the default.

BTW we really should introduce new functions to replace completing-read
(and most others that derive from it) where the DEFAULT argument is made
more prominent (maybe even non-optional) and is automatically added to
the prompt.  Also, this new function could check that DEFAULT is
accepted by the completion tables before returning (or using) it.

This would also allow users to replace this function with one which
handles DEFAULT differently (e.g. inserting it as initial-input but
pre-selected so that delete-selection-mode deletes it in many cases).


        Stefan



reply via email to

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