Use projectile for narf/project-root

This commit is contained in:
Henrik Lissner 2015-10-28 17:29:40 -04:00
parent 8660536b5b
commit e334815395

View file

@ -4,17 +4,24 @@
(defun narf/project-root (&optional strict-p) (defun narf/project-root (&optional strict-p)
"Get the path to the root of your project. Uses `narf-project-root-files' to "Get the path to the root of your project. Uses `narf-project-root-files' to
determine if a directory is a project." determine if a directory is a project."
(let ((home (file-truename "~"))) (let (projectile-require-project-root strict-p) (projectile-project-root))
(catch 'found ;; (let ((home (file-truename "~"))
(f-traverse-upwards ;; (path default-directory))
(lambda (path) ;; (unless (file-name-absolute-p path)
(let ((path (file-truename path))) ;; (setq path (expand-file-name path)))
(if (file-equal-p home path) ;; (catch 'found
(throw 'found (if strict-p nil default-directory)) ;; (ignore-errors
(dolist (file narf-project-root-files) ;; (f-traverse-upwards
(when (file-exists-p (expand-file-name file path)) ;; (lambda (path)
(throw 'found path)))))) default-directory) ;; (let ((path (file-truename path)))
default-directory))) ;; (if (file-equal-p home path)
;; (throw 'found (if strict-p nil default-directory))
;; (dolist (file narf-project-root-files)
;; (when (file-exists-p (expand-file-name file path))
;; (throw 'found path))))))
;; path))
;; default-directory))
)
;;;###autoload ;;;###autoload
(defun narf/project-has-files (files &optional root) (defun narf/project-has-files (files &optional root)