05 Nov 2019
Populating Projectile's cache
As I track the develop branch of Spacemacs I occasionally clean out my cache of projects known to Projectile. Every time it takes a while before I'm back at a stage where I very rarely have to visit something that isn't already in the cache.
However, today I found the function projectile-add-known-project
, which
prompted me to write the following function that'll help me quickly re-building
the cache the next time I need to reset Spacemacs to a known state again.
(defun projectile-extra-add-projects-in-subfolders (projects-root) (interactive (list (read-directory-name "Add to known projects: "))) (message "Searching for projects in %s..." projects-root) (let ((dirs (seq-map 'file-name-directory (directory-files-recursively projects-root "^.git$" t)))) (seq-do 'projectile-add-known-project dirs) (message "Added %d projects" (length dirs))))