Subject: Re: bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects

From: Dmitry Gutov <[email-masked]>
Date: Fri, 3 Jul 2020 16:13:49 +0300

On 03.07.2020 14:48, Eli Zaretskii wrote:
>> Cc: [email-masked], [email-masked]
>> From: Dmitry Gutov <[email-masked]>
>> Date: Fri, 3 Jul 2020 13:23:05 +0300
>>
>>> You assume that most users don't know about or use M-n?  I do it all
>>> the time, and would like to think others do as well.
>>
>> I assume, yes.
>>
>> But even if they do, I'm not sure how this extra capability could harm them.
> 
> ??? Offering incorrect default doesn't cause harm?

Offering known project roots directories would be incorrect?

>>>> If an xref backend doesn't define the xref-backend-references method,
>>>> the alternative is no references at all.
>>>
>>> The alternative could be to start with the current directory, or ask
>>> the user.
>>
>> Using the current directory will result in worse results almost always,
> 
> Worse than searching unrelated directories?

Worse than the current behavior.

And either way, using just the current directory will almost always 
result in *missing* valid references from the results. That's much worse 
than including some irrelevant results, potentially.

> Perhaps you are thinking
> about the use case where the project-related directories are indeed
> relevant to the search.  I was thinking about the opposite use case.

I'm not sure about the totality of the use cases that would be helped or 
harmed by the current approach. But I have yet to see a single user 
complain about the current behavior.

>> IME. Prompting the user every time is not a great experience either.
> 
> Not every time, only the first time.  Afterwards, the user has the
> history.

They can only input one directory this way. A project can include 
"external roots".

>>> But do we have xref backends that don't define the
>>> xref-backend-references method?  If so, which ones don't?
>>
>> Neither of the built-in ones does. :-)
> 
> But currently, they don't offer project-related defaults, do they?  At
> least not in released versions of Emacs.

What do you mean? Doesn't 'M-x xref-find-references' work for you?

This situation has been in place for ~5 years now.

>>> "Imperfect" and "completely wrong" is not the same at all.  Searching
>>> the wrong directory hierarchy will get you the latter.
>>
>> Perhaps. To get better results, the user will have to set up the project
>> configuration better.
> 
> Like what?

Like using a project backend that would describe the locations of their 
source files better.

> I don't think I understand how project configuration could
> help in non project-related searches.

And you lost me here. xref backend doesn't equal a project backend, but 
you can't claim they are entirely unrelated either (from the user's 
point of view), or that their configurations don't correlate heavily.