]> git.eshelyaron.com Git - emacs.git/commitdiff
project-remember-project: Support calling it interactively
authorDmitry Gutov <dmitry@gutov.dev>
Thu, 29 May 2025 19:26:59 +0000 (22:26 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 7 Jun 2025 19:53:37 +0000 (21:53 +0200)
* lisp/progmodes/project.el (project-remember-project):
Support interactive invocation (bug#78099) and react with
appropriate messages when called so, depending on the blacklist.

(cherry picked from commit f0bec20ac58ab84895b832fc545ea14c442d8332)

lisp/progmodes/project.el

index 27075825b9ee1bf2fb3f9e5b0c47f88e91b4138c..b551e8b06fb27e4446bf06cf8e7dcc92d1adc63c 100644 (file)
@@ -1868,12 +1868,18 @@ has changed, and NO-WRITE is nil."
 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)
+  (interactive (list (project-current t)))
+  (let ((root (project-root pr))
+        (interact (called-interactively-p 'any)))
+    (if (seq-some (lambda (r)
+                    (if (functionp r)
+                        (funcall r pr)
+                      (string-match-p r root)))
+                  project-list-exclude)
+        (when interact
+          (message "Current project is blacklisted!"))
+      (when interact
+        (message "Current project remembered"))
       (project--remember-dir root no-write))))
 
 (defun project--remove-from-project-list (project-root report-message)