Skip to content

Commit

Permalink
feat(project): add +project-forget-duplicate-projects helper
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 20, 2023
1 parent f6eb79e commit 87345a3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions elisp/+project.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ to scan directories recursively."
(root-dir (car cons-dir))
(recursive (cdr cons-dir))
(sub-dirs (and (file-directory-p root-dir) (+directory-subdirs root-dir))))
(dolist (dir sub-dirs)
(project-remember-projects-under dir recursive)))))
(dolist (dir sub-dirs)
(project-remember-projects-under dir recursive)))))

;;;###autoload
(defun +project-add-project (dir &optional dont-ask)
Expand All @@ -51,4 +51,11 @@ When DIR is not detected as a project, ask to force it to be by adding a
(let ((default-directory (project-root (project-current t))))
(call-interactively #'gdb)))

(defun +project-forget-duplicate-projects ()
"Forget all duplicate known projects (/home/user/proj, ~/proj)."
(interactive)
(let* ((projs (mapcar #'expand-file-name (project-known-project-roots)))
(projs (cl-set-difference projs (cl-remove-duplicates projs :test #'string=))))
(mapc #'project-forget-project projs)))

;;; +project.el ends here

0 comments on commit 87345a3

Please sign in to comment.