Function: project-forget-projects-under
project-forget-projects-under is an interactive and byte-compiled
function defined in project.el.gz.
Signature
(project-forget-projects-under DIR &optional RECURSIVE)
Documentation
Forget all known projects below a directory DIR.
Interactively, prompt for DIR. Optional argument RECURSIVE, if non-nil (interactively, the prefix argument), means recurse into subdirectories under DIR to remove those projects from the index. Display a message at the end summarizing what was forgotten. Return the number of forgotten 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-forget-projects-under (dir &optional recursive)
"Forget all known projects below a directory DIR.
Interactively, prompt for DIR.
Optional argument RECURSIVE, if non-nil (interactively, the prefix
argument), means recurse into subdirectories under DIR
to remove those projects from the index.
Display a message at the end summarizing what was forgotten.
Return the number of forgotten projects."
(interactive "DDirectory: \nP")
(let ((count 0))
(if recursive
(dolist (proj (project-known-project-roots))
(when (file-in-directory-p proj dir)
(project-forget-project proj)
(setq count (1+ count))))
(dolist (proj (project-known-project-roots))
(when (file-equal-p (file-name-directory proj) dir)
(project-forget-project proj)
(setq count (1+ count)))))
(if (zerop count)
(message "No projects were forgotten")
(project--write-project-list)
(message (ngettext "%d project was forgotten"
"%d projects were forgotten"
count) count))
count))