Skip to content

Commit 910ee3c

Browse files
committed
Refactor php-project-root and add describe about this variable
1 parent cbd5cf9 commit 910ee3c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

php-project.el

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
;;
3838
;; - `php-project-coding-style'
3939
;; - Symbol value of the coding style. (ex. `pear', `psr2')
40-
;;
40+
;; - `php-project-root'
41+
;; - Symbol of marker file of project root. (ex. `git', `composer')
42+
;; - Full path to project root directory. (ex. "/path/to/your-project")
4143
;;
4244

4345
;;; Code:
@@ -86,12 +88,13 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
8688
;;;###autoload
8789
(defun php-project-get-root-dir ()
8890
"Return path to current PHP project."
89-
(let ((detect-method (if (stringp php-project-root)
90-
(list php-project-root)
91-
(if (eq php-project-root 'auto)
92-
(cl-loop for m in php-project-available-root-files
93-
append (cdr m))
94-
(cdr-safe (assq php-project-root php-project-available-root-files))))))
91+
(let ((detect-method
92+
(cond
93+
((stringp php-project-root) (list php-project-root))
94+
((eq php-project-root 'auto)
95+
(cl-loop for m in php-project-available-root-files
96+
append (cdr m)))
97+
(t (cdr-safe (assq php-project-root php-project-available-root-files))))))
9598
(cl-loop for m in detect-method
9699
thereis (locate-dominating-file default-directory m))))
97100

0 commit comments

Comments
 (0)