Commits

Anonymous committed 6cad2a2

Add projectile setup until "subprojects" are fixed in the upstream

  • Participants
  • Parent commits 52b8b47

Comments (0)

Files changed (1)

   (progn
     (push '("*Pp Eval Output*" :height 15) popwin:special-display-config)))
 
+(use-package projectile
+  :defer t
+  :config
+  (progn
+    (defun projectile-project-root ()
+      "Retrieves the root directory of a project if available.
+The current directory is assumed to be the project's root otherwise."
+      (let ((project-root
+             (or (->> projectile-project-root-files
+                   (--map (locate-dominating-file (file-truename default-directory) it))
+                   (-remove #'null)
+                   (--max-by (> (s-count-matches "/" it) (s-count-matches "/" other))) ;;; return the closest "parent dir" for this (possible) subproject
+                   (projectile-file-truename))
+                 (if projectile-require-project-root
+                     (error "You're not in a project")
+                   default-directory))))
+        project-root))
+
+    (defun projectile-get-ext-command ()
+      "Determine which external command to invoke based on the project's VCS."
+      (concat
+       "find . -not \\( \\( "
+       (mapconcat (lambda (x)
+                    (concat "-path \"*/" x "/*\"")) projectile-globally-ignored-directories " -or ")
+       (let ((proj-ig-dirs (projectile-project-ignored-directories)))
+         (if (not proj-ig-dirs) ""
+           (concat
+            " -or "
+            (mapconcat (lambda (x)
+                         (concat "-path \"" x "\""))
+                       (let ((project-root (projectile-project-root)))
+                         (--map (concat "./" (file-relative-name it project-root)) proj-ig-dirs)) " -or "))))
+       " \\) -prune \\)"
+       " -not "
+       (mapconcat (lambda (x)
+                    (concat "-path \"*/" x "\"")) projectile-globally-ignored-directories " -not ")
+       " -type f -print0"))))
+
 (use-package revbufs
   :bind ("C-<f5>" . revbufs))