2015-06-15 09:05:52 +02:00
|
|
|
;;; defuns-project.el
|
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom/project-root (&optional strict-p)
|
|
|
|
"Get the path to the root of your project. Uses `doom-project-root-files' to
|
2015-06-15 09:05:52 +02:00
|
|
|
determine if a directory is a project."
|
2016-02-26 00:08:41 -05:00
|
|
|
(let (projectile-require-project-root strict-p)
|
|
|
|
(projectile-project-root)))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom/project-has-files (files &optional root)
|
2016-02-13 01:12:25 -05:00
|
|
|
"Return non-nil if FILES exist in the project root."
|
2016-05-20 22:37:30 -04:00
|
|
|
(let ((root (or root (doom/project-root)))
|
2015-06-15 09:05:52 +02:00
|
|
|
(files (if (listp files) files (list files)))
|
2016-02-13 01:12:25 -05:00
|
|
|
(found-p (if files t)))
|
2016-02-26 00:08:41 -05:00
|
|
|
(while (and found-p files)
|
|
|
|
(let ((file (expand-file-name (pop files) root)))
|
|
|
|
(setq found-p (if (string-suffix-p "/" file)
|
|
|
|
(file-directory-p file)
|
|
|
|
(file-exists-p file)))))
|
2015-06-15 09:05:52 +02:00
|
|
|
found-p))
|
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-20 22:37:30 -04:00
|
|
|
(defalias 'doom/project-p 'projectile-project-p)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defalias 'doom/project-name 'projectile-project-name)
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
(provide 'defuns-project)
|
|
|
|
;;; defuns-project.el ends here
|