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

From: Dmitry Gutov <[email-masked]>
Date: Tue, 30 Jun 2020 15:36:26 +0300

On 30.06.2020 01:58, Juri Linkov wrote:

> Note the same prefix 'project-vc' for vc backend of project.el.
> Then 'project-vc-known-roots' in project.el be like this:
> 
> (defun project-vc-known-roots ()
>    "Return a list of known vc roots."
>    (seq-filter #'project-try-vc (project-known-project-roots)))

You suggested this before. Special-casing a particular backend in a 
general purpose public function is not a good idea.

> Also every command that visits a directory in vc could register their dir
> in the project list when project.el is loaded, for example:
> 
>    (defun vc-dir (dir &optional backend)
>     ...
>     (when (featurep 'project)
>      ;; Add current vc project dir to project list
>      (let ((default-directory dir))
>       (project-current t)))

Having considered it more, I now have more doubt on whether this 
approach is a good idea in general.

See, even when the project backend is VC, there is no guarantee that its 
root will be the repository's root. First, there are submodules (and 
whether a submodule root is a project root is customizable). Second, 
there is an existing feature request to use also some other project root 
markers, even inside VC repos (the "monorepo" case). These might end up 
in the 'vc' backend as well.

So things as they are, I'd rather VC has a separate roots history, or we 
at least put this feature request on hold (and, for now, revert the 
installed patches).