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: Dmitry Gutov
Subject: Re: make project--find-in-file generic, add interactive filename to project-find-file
Date: Thu, 28 Jan 2016 13:36:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Thunderbird/44.0

On 01/28/2016 01:11 PM, Stephen Leake wrote:

- 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?

and then you don't need to make that value depend on
current-prefix-arg.

Actually, I did not intend to make it depend on current-prefix-arg, as
the doc string does not mention that; I forgot to fix that when I copied
from my current code.

On the other hand, it makes sense to give the user some control over
whether the file at point is used.

Indeed.

However, the default still does not show anywhere;
we should add it to the prompt.

Agree. If we end up using the default.

And I see no good reason to thread it through the command's function
arguments. Why not do it like in the patch at the bottom?

Because there are also times when calling `project-find-file' from lisp
with a filename makes sense.

In a user-defined command? Maybe.

But that code can call
project--find-file-in, instead of project-find-file.

It'll have to become a public function, though, if we're really considering this use case.

- More importantly, the new generic function should not do too much.
It should return a completion table, which can dispatch to ede,
ada-mode, or any other facility. I believe we've went over this a
couple of times already.

So instead of computing `table' in project--find-file-in, it would
call (project--file-completion-table dirs project). The default
implementation of `project--file-completion-table' would be the code
using `find-program'.

Pretty much, except it should have a public name (no double-dash), and the project should probably be the first argument.



reply via email to

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