Function: project-remember-projects-under
project-remember-projects-under is an interactive and byte-compiled
function defined in project.el.gz.
Signature
(project-remember-projects-under DIR &optional RECURSIVE)
Documentation
Remember projects below a directory DIR.
Interactively, prompt for DIR. Optional argument RECURSIVE, if non-nil (interactively, the prefix argument) means recurse into subdirectories of DIR to find more projects. Display a message at the end summarizing what was found. Return the number of detected projects.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
(defun project-remember-projects-under (dir &optional recursive)
"Remember projects below a directory DIR.
Interactively, prompt for DIR.
Optional argument RECURSIVE, if non-nil (interactively, the prefix
argument) means recurse into subdirectories of DIR to find more
projects.
Display a message at the end summarizing what was found.
Return the number of detected projects."
(interactive "DDirectory: \nP")
(project--ensure-read-project-list)
(let ((dirs (if recursive
(directory-files-recursively dir "" t)
(directory-files dir t)))
(known (make-hash-table :size (* 2 (length project--list))
:test #'equal))
(count 0))
(dolist (project (mapcar #'car project--list))
(puthash project t known))
(dolist (subdir dirs)
(when-let* (((file-directory-p subdir))
(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))))
(if (zerop count)
(message "No projects were found")
(project--write-project-list)
(message (ngettext "%d project was found"
"%d projects were found"
count) count))
count))