From 0c35d3d3e99aa95c07ad76dac62c002500115b9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:35:52 +0200 Subject: Emacs: Re-implement project-directory functions --- emacs/.emacs.d/init.org | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'emacs') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e7cbedc..0f43c84 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -482,16 +482,21 @@ based upon some folder conventions I use. :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) -- cgit 1.4.1