Subject: Re: bug#76587: 31.0.50; [FR] project.el should have a way to exclude certain projects from being saved

From: Dmitry Gutov <[email-masked]>
Date: Thu, 27 Feb 2025 05:14:59 +0200

Hi!

On 26/02/2025 15:59, Visuwesh wrote:
> It is quite frustrating to use C-x p p to jump to projects when it can
> easily get cluttered with projects that you never want to jump to.
> E.g., as my user-emacs-directory only really tracks init.el, I don't
> want project.el to save it in the projects file.  When it does, it gets
> in the way when I am completing ~/lib/ports/emacs which is where I keep
> my checkout of the Emacs repo.
> Likewise, I do not want to save remote projects at all.

This sounds reasonable. Should we call it something like 
project-list-exclude[-regexps]?

> AFAIU, the current way is to use project-forget-project and friends, but
> they are cumbersome.  They work nice when you want to remove a
> "completed" project but they don't help when you want to use project
> commands judiciously for "temporary" projects (like a checkout that
> you're editing for a patch).

Temporary checkouts might not be worth it in terms of that user option 
(calling M-x ...-forget-project is faster than doing the checkout), but 
that's just my opinion.

> I would like to have a user option like
> recentf-exclude which would prevent project--write-project-list from
> saving certain projects.  To that end, I propose the following patch,
> WDYT?

Haven't looked at the details of the implementation yet, but the 
recentf-exclude model sounds good.

> P.S. I wish there was a way for project backends to bow out from
> project--write-project-list too.  Context: I have a "sibling-file"
> project backend which mainly offers meaningful candidates to C-x p f
> when visiting a file that has associated siblings.

This sounds a bit confusing. When you use this other backend (how? is it 
enabled manually?), do you visit disjoint repositories through it? Or 
only a subset of a files in a repository? What do you do when you want 
to visit other files in it?

> I could use
> find-sibling-file but using project.el comes with bonuses like
> project-list-buffer, etc.

 From where I'm standing, it might be more ergonomical to add a few 
extra commands for the "siblings" search, and bind them to a submap. But 
I'm probably missing something.