Subject: bug#78099: [PATCH] Make 'project-remember-project' interactive

From: Juri Linkov <[email-masked]>
Date: Mon, 28 Apr 2025 18:03:34 +0300

> Sometimes when creating a new project it is not added to project list.
> AFAIK the only way to do it is using `project-remember-projects-under'
> or `project-switch-project' but they are uncomfortable to use when you
> just want to remember the current project you're in.
>
> So I decided to make `project-remember-project' interactive in this
> patch for archive this; this let to users use it in hooks (e.g
> find-file-hook)

For the same purpose I added an advice to functions like
'read-directory-name' and 'vc-dir' with the trick to
call 'project-current' that remembers a new project:

(define-advice vc-dir (:after (dir &optional _backend) add-project)
  (when (featurep 'project)
    ;; Add current vc project dir to project list
    (let ((default-directory dir))
      (project-current))))

But maybe `project-remember-project' would be more correct to use here.