Subject: bug#63870: 29.0.90; project.el can't dynamically populate the project list

From: Dmitry Gutov <[email-masked]>
Date: Sat, 17 Jun 2023 05:55:59 +0300

Hi!

On 03/06/2023 14:55, Spencer Baugh wrote:
> I'd like a customization point where I can supply a function (or list of
> functions) which project-known-project-roots should run to produce an
> additional list of project root directories, which should then be
> appended to project--list.

Are you sure the existing functions won't cut it? Such as 
project-remember-project and project-forget-project.

The names might seem a little wrong, but keeping in mind that 
project--list is about having a list of projects "remembered" somewhere, 
they're probably fine. And you could let-bind project--list somewhere at 
the top level in your function/command/etc, so the list is not altered 
in the end.

> I don't need project.el to specifically remember these projects; they'll
> be remembered automatically as users use them, and completing-read will
> nicely deduplicate the project roots anyway.

We could add some var like project-list-no-write, so that dynamic 
changes don't get written to disk.

Unless you want to keep the "dynamic" list to be used by regular 
commands, that is.

In that case, the above will probably not suffice. We could go with your 
approach, or even add some project-list-sources hook.

But how would the entries from different sources (e.g. the list file and 
your dynamic list) combined? How will they be sorted?

In case we can't come up with a generic way, we could simply add a 
generic storage abstraction (similar to xref-history-storage), which you 
would override/advise to combine the lists as needed for your usage.