all repos — archive/dotfiles @ 0c35d3d3e99aa95c07ad76dac62c002500115b9b

Superseded by nixfiles

Emacs: Re-implement project-directory functions
Alan Pearce alan@alanpearce.uk
Fri, 21 Apr 2017 20:35:52 +0200
commit

0c35d3d3e99aa95c07ad76dac62c002500115b9b

parent

967dc8a329804a7b3517a34a4b6c35f11ed9edc4

1 files changed, 12 insertions(+), 7 deletions(-)

jump to
M emacs/.emacs.d/init.orgemacs/.emacs.d/init.org
@@ -482,16 +482,21 @@ :diminish projectile-mode   :config (progn
             (projectile-global-mode)
             (add-to-list 'projectile-globally-ignored-directories ".stversions")
-            (defun ap/subfolder-projects (dir)
-              (--map (file-relative-name it dir)
-                     (-filter (lambda (subdir)
-                                (--reduce-from (or acc (funcall it subdir)) nil
-                                               projectile-project-root-files-functions))
-                              (-filter #'file-directory-p (directory-files dir t "\\<")))))
+
+            (defun directory-directories (dir)
+              (seq-filter #'file-directory-p
+                          (directory-files dir t (rx string-start
+                                                     (char alnum)))))
+
+            (defun project-directories (start-dir)
+              (seq-map (lambda (x) (file-relative-name x start-dir))
+                       (seq-mapcat #'directory-directories
+                                   (seq-mapcat #'directory-directories
+                                               (directory-directories start-dir)))))
 
             (defun ap/open-subfolder-project (from-dir &optional arg)
               (let ((project-dir (projectile-completing-read "Open project: "
-                                                             (ap/subfolder-projects from-dir))))
+                                                             (project-directories from-dir))))
                 (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg)))
 
             (defun yarn-install (&optional arg)