unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57714: [PATCH] Fix project-remember-projects-under recursive
@ 2022-09-10  7:46 ookami via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-10 12:57 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: ookami via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-10  7:46 UTC (permalink / raw)
  To: 57714

From 748928f579388b018f50265d0826075d5d12071c Mon Sep 17 00:00:00 2001
From: ookami <mail@ookami.one>
Date: Sat, 10 Sep 2022 15:43:23 +0800
Subject: [PATCH] Fix project-remember-projects-under recursive

---
 lisp/progmodes/project.el | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 30f51704dc..d07acf361e 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1498,7 +1498,9 @@ project-remember-projects-under
 projects."
   (interactive "DDirectory: \nP")
   (project--ensure-read-project-list)
-  (let ((queue (directory-files dir t nil t)) (count 0)
+  (let ((queue (directory-files
+                dir t directory-files-no-dot-files-regexp t))
+        (count 0)
         (known (make-hash-table
                 :size (* 2 (length project--list))
                 :test #'equal )))
@@ -1506,15 +1508,20 @@ project-remember-projects-under
       (puthash project t known))
     (while queue
       (when-let ((subdir (pop queue))
-                 ((file-directory-p subdir))
-                 ((not (gethash subdir known))))
-        (when-let (pr (project--find-in-directory subdir))
-          (project-remember-project pr t)
-          (message "Found %s..." (project-root pr))
+                 ((file-directory-p subdir)))
+        (when-let ((project (project--find-in-directory subdir))
+                   (project-root (project-root project))
+                   ((not (gethash project-root known))))
+          (project-remember-project project t)
+          (puthash project-root t known)
+          (message "Found %s..." project-root)
           (setq count (1+ count)))
-        (when (and recursive (file-symlink-p subdir))
-          (setq queue (nconc (directory-files subdir t nil t) queue))
-          (puthash subdir t known))))
+        (when (and recursive (file-directory-p subdir))
+          (setq queue
+                (nconc
+                 (directory-files
+                  subdir t directory-files-no-dot-files-regexp t)
+                 queue)))))
     (unless (eq recursive 'in-progress)
       (if (zerop count)
           (message "No projects were found")
-- 
2.37.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#57714: [PATCH] Fix project-remember-projects-under recursive
  2022-09-10  7:46 bug#57714: [PATCH] Fix project-remember-projects-under recursive ookami via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-10 12:57 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-10 12:57 UTC (permalink / raw)
  To: ookami; +Cc: 57714

ookami <mail@ookami.one> writes:

> Subject: [PATCH] Fix project-remember-projects-under recursive

Thanks.  The patch doesn't seem to be totally correct, though --

(project-remember-projects-under "~/src/emacs/trunk/" t)

would return 0.  (I.e., when the directory given is a project.)  So I've
fixed that condition and then pushed your patch to Emacs 29.

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-10 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-10  7:46 bug#57714: [PATCH] Fix project-remember-projects-under recursive ookami via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-10 12:57 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).