summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-04-24 19:34:02 +0200
committerAlan Pearce2017-04-24 19:34:02 +0200
commit819d7f6ea51d9b1b52b3f283e6b9193dcd5f46e6 (patch)
tree77e2497374155eb15a30ff0ed21ba33567a6a4d1
parent7f7087d808a6e441e6c3aa36aa8328e93f63d256 (diff)
downloaddotfiles-819d7f6ea51d9b1b52b3f283e6b9193dcd5f46e6.tar.lz
dotfiles-819d7f6ea51d9b1b52b3f283e6b9193dcd5f46e6.tar.zst
dotfiles-819d7f6ea51d9b1b52b3f283e6b9193dcd5f46e6.zip
Emacs: Simplify project opening logic
Use ghq to do the heavy lifting
-rw-r--r--emacs/.emacs.d/init.org22
1 files changed, 5 insertions, 17 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 5830055..84609ac 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -479,22 +479,6 @@ based upon some folder conventions I use.
             (projectile-global-mode)
             (add-to-list 'projectile-globally-ignored-directories ".stversions")
 
-            (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: "
-                                                             (project-directories from-dir))))
-                (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg)))
-
             (defun yarn-install (&optional arg)
               (interactive "P")
               (projectile-with-default-dir (projectile-project-root)
@@ -517,7 +501,11 @@ based upon some folder conventions I use.
 
             (defun ap/open-project (&optional arg)
               (interactive "P")
-              (ap/open-subfolder-project projects-root-directory arg))
+              (let ((project-dir (projectile-completing-read
+                                  "Open project: "
+                                  (ghq--find-projects))))
+                (projectile-switch-project-by-name
+                 (expand-file-name project-dir (ghq--find-root)) arg)))
 
             (setq projectile-switch-project-action #'projectile-commander
                   projectile-completion-system 'ivy)))