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

From: Visuwesh <[email-masked]>
Date: Thu, 27 Feb 2025 15:26:27 +0530

[வியாழன் பிப்ரவரி 27, 2025] Juri Linkov wrote:

>> 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?
>
> recentf-exclude supports a list of regexps and predicates:
>
>   (defcustom recentf-exclude nil
>     "List of regexps and predicates for filenames excluded from the recent list.
>     ..."
>     :type '(repeat (choice regexp function)))
>
> Would it be possible also to check a predicate on the project list?
>
> I need this to be able to remove the advice from my config:
>
>   ;; Don't remember transient projects:
>   (define-advice project-remember-project (:before-until (pr &rest _) skip)
>     (eq (car pr) 'transient))

So something like

    (defcustom project-list-exclude nil
      "List of regexps and predicates for project root and objects to exclude."
      :type '(repeat (choice regexp function))
      :version "31.1"
      :group 'project)

as we cannot remove your advice if we don't pass the project object to
the predicate.

BTW, would it be too late to check this user option in
project--write-project-list, or should we check this in
project-remember-project as in your advice?  IIUC, the former would more
closely resemble recentf's behaviour.