Subject: Re: bug#74826: 30.0.50; project-buffers not consistent with project-files

From: Dmitry Gutov <[email-masked]>
Date: Fri, 13 Dec 2024 05:46:32 +0200

Hi! Thanks for the report.

On 12/12/2024 14:11, Óscar Fuentes wrote:
> On a git repo there are several projects.
> `project-vc-extra-root-markers` is used to differentiate them.
> 
> (setopt project-vc-extra-root-markers (list "client.lp0" "pubspec.yaml"))
> 
> Although there are no submodules for now, I also have this setting:
> 
> (setopt project-vc-merge-submodules nil)
> 
> Evaluating the following expression while on a buffer that is visiting
> any given file of those projects:
> 
> (project-files (project-current))
> 
> gives the list of files of the project.
> 
> However, evaluating this fails:
> 
> (project-buffers (project-current))

This change should fix that.

Not sure if it should go to emacs-30 (this bug is there since 2022) - 
but happy to install it there if approved.

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 2b0d508cc66..59a8832711a 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -858,7 +858,9 @@ project--value-in-dir
  (cl-defmethod project-buffers ((project (head vc)))
    (let* ((root (expand-file-name (file-name-as-directory (project-root 
project))))
           (modules (unless (or (project--vc-merge-submodules-p root)
-                              (project--submodule-p root))
+                              (condition-case nil
+                                  (project--submodule-p root)
+                                (file-missing nil)))
                      (mapcar
                       (lambda (m) (format "%s%s/" root m))
                       (project--git-submodules))))