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

From: Elijah Gabe Pérez <[email-masked]>
Date: Tue, 29 Apr 2025 18:38:05 -0600

Dmitry Gutov <[email-masked]> writes:

> So your scenario is to add a project but not do anything else
> project-related with it, at that time?

Yes, so for not to break the default project-remember functionality.
In any case that's why exists the other project commands.

> On 27/04/2025 23:18, Elijah Gabe Pérez wrote:
>> +  (interactive)
>
> Something like
>
>   (interactive (list (project-current t)))
>
> should allow to keep PR a required argument.

Thanks, done:

>From 60b1f5200ab82daaad3ea841feacbc7d78b37f83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <[email-masked]>
Date: Sun, 27 Apr 2025 13:44:39 -0600
Subject: [PATCH] Make 'project-remember-project' interactive

* lisp/progmodes/project.el (project-remember-project): Tweak.
---
 lisp/progmodes/project.el | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 1a8bba67124..6b386914899 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1987,18 +1987,26 @@ project--remember-dir
         (project--write-project-list)))))
 
 ;;;###autoload
-(defun project-remember-project (pr &optional no-write)
-  "Add project PR to the front of the project list.
+(defun project-remember-project (&optional pr no-write)
+  "Add project PR or current project to the front of the project list.
 If project PR satisfies `project-list-exclude', then nothing is done.
 Save the result in `project-list-file' if the list of projects
 has changed, and NO-WRITE is nil."
-  (let ((root (project-root pr)))
-    (unless (seq-some (lambda (r)
-                        (if (functionp r)
-                            (funcall r pr)
-                          (string-match-p r root)))
-                      project-list-exclude)
-      (project--remember-dir root no-write))))
+  (interactive (list (project-current)))
+  (if-let* (pr
+            (interac (called-interactively-p 'any))
+            (root (project-root pr)))
+      (if (not (seq-some (lambda (r)
+                           (if (functionp r)
+                               (funcall r pr)
+                             (string-match-p r root)))
+                         project-list-exclude))
+          (progn
+            (project--remember-dir root no-write)
+            (when interac (message "Current project remember")))
+        (when interac (message "Current project is blacklisted!")))
+    (when (called-interactively-p 'any)
+      (user-error "There is not a project here!"))))
 
 (defun project--remove-from-project-list (project-root report-message)
   "Remove directory PROJECT-ROOT of a missing project from the project list.
-- 
2.49.0

-- 
                                          - E.G via GNU Emacs and Org.