[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63870: 29.0.90; project.el can't dynamically populate the project li
From: |
Spencer Baugh |
Subject: |
bug#63870: 29.0.90; project.el can't dynamically populate the project list |
Date: |
Tue, 27 Jun 2023 15:29:48 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Dmitry Gutov <dmitry@gutov.dev> writes:
> 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.
Oh, certainly project-{remember,forget}-project work, indeed I've used
them in the patch I just posted. I think I was unclear about what I
wanted, perhaps that patch clarifies what exactly I was looking for.
>> 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.
I don't think these changes are necessary after all. (Which is good,
because they would add a fair bit of complexity.) This file-notify
approach I think should work perfectly for a wide variety of uses.