summary refs log tree commit diff stats
path: root/tag-emacs
diff options
context:
space:
mode:
Diffstat (limited to 'tag-emacs')
-rw-r--r--tag-emacs/emacs.d/init.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index 3e24147..00d595f 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -32,6 +32,9 @@
                       (file-name-directory (file-truename init-file))))
   "Where the emacs init file really is, passing through symlinks.")
 
+(defvar work-project-directory "~/work")
+(defvar home-project-directory "~/projects")
+
 ;;;; Package Management
 (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory))
 
@@ -657,6 +660,34 @@
   :init (projectile-global-mode)
   :diminish projectile-mode
   :config (progn
+            (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 ap/-add-known-subfolder-projects (dir)
+              (-map #'projectile-add-known-project (ap/subfolder-projects dir)))
+
+            (defun ap/add-known-subfolder-projects ()
+              (interactive)
+              (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: ")))
+
+            (defun ap/open-subfolder-project (from-dir &optional arg)
+              (let ((project-dir (projectile-completing-read "Open project: "
+                                                             (ap/subfolder-projects from-dir))))
+                (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg)))
+
+            (defun ap/open-work-project (&optional arg)
+              (interactive "P")
+              (ap/open-subfolder-project work-project-directory arg))
+
+            (defun ap/open-home-project (&optional arg)
+              (interactive "P")
+              (ap/open-subfolder-project home-project-directory arg))
+
+
             (setq projectile-switch-project-action #'projectile-dired
                   projectile-remember-window-configs t)))