Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b1dd3f

Browse files
committed
[emacs] Preload git project directories into projectile
1 parent 34e76f1 commit 3b1dd3f

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

.doom.d/config.org

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,21 +1306,22 @@ Pre-load Projectile with projects in my usual code directories.
13061306
;; doom overrides projectile-switch-project-action for its workspace behavior,
13071307
;; so rather than update that, set the workspaces switch project function.
13081308
(setq +workspaces-switch-project-function #'magit-status)
1309-
(let ((project-directories (-filter #'f-directory?
1310-
'("~/code"
1311-
"~/git"))))
1312-
(-map
1313-
(lambda (directory)
1314-
(-map (lambda (project)
1315-
(-> (concat project "/") ;; Projectile likes trailing slashes
1316-
(projectile-add-known-project)))
1317-
(-filter (lambda (f) (and (not (s-ends-with? "." f))
1318-
(f-directory? f)))
1319-
(-map (lambda (f) (concat directory "/" f))
1320-
(directory-files directory)))))
1321-
project-directories))
1322-
1323-
(projectile-cleanup-known-projects))
1309+
1310+
(defvar my/projectile-projects-cache (concat doom-cache-dir "my-projects"))
1311+
(defun my/projectile-add-known-projects ()
1312+
(interactive)
1313+
(->> (-filter #'f-directory? '("~/code" "~/git" "~/src"))
1314+
(--map (directory-files-recursively it "^\.git$" t #'f-directory?))
1315+
(-flatten)
1316+
(-map #'f-parent)
1317+
(--map (concat it "/"))
1318+
(-map #'projectile-add-known-project)))
1319+
(unless (f-exists? my/projectile-projects-cache)
1320+
(my/projectile-add-known-projects)
1321+
(with-temp-buffer
1322+
(insert (s-join "\n" projectile-known-projects))
1323+
(write-file my/projectile-projects-cache))
1324+
(projectile-cleanup-known-projects)))
13241325
#+end_src
13251326
*** Jira
13261327
Add some commands for interacting with Jira within org documents.

0 commit comments

Comments
 (0)