project-remember-project: Support calling it interactively

* lisp/progmodes/project.el (project-remember-project):
Support interactive invocation (bug#78099) and react with
appropriate messages when called so, depending on the blacklist.
This commit is contained in:
Dmitry Gutov 2025-05-29 22:26:59 +03:00
parent c9cb89edd5
commit f0bec20ac5
2 changed files with 14 additions and 6 deletions

View file

@ -429,6 +429,8 @@ This user option describes projects that should always be skipped by
*** New command 'project-save-some-buffers' bound to 'C-x p C-x s'.
This is like 'C-x s', but only for this project's buffers.
*** 'project-remember-project' can now be called interactively.
** Registers
*** New functions 'buffer-to-register' and 'file-to-register'.

View file

@ -1936,12 +1936,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)