summaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/php-project.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/lisp/php-project.el')
-rw-r--r--.emacs.d/lisp/php-project.el29
1 files changed, 18 insertions, 11 deletions
diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el
index c36c81f..d478d9e 100644
--- a/.emacs.d/lisp/php-project.el
+++ b/.emacs.d/lisp/php-project.el
@@ -95,10 +95,15 @@
95 Try to search file in order of `php-project-available-root-files'. 95 Try to search file in order of `php-project-available-root-files'.
96 96
97SYMBOL 97SYMBOL
98 Key of `php-project-available-root-files'.") 98 Key of `php-project-available-root-files'.
99
100STRING
101 A file/directory name of top level marker.
102 If the string is an actual directory path, it is set as the absolute path
103 of the root directory, not the marker.")
99 (make-variable-buffer-local 'php-project-root) 104 (make-variable-buffer-local 'php-project-root)
100 (put 'php-project-root 'safe-local-variable 105 (put 'php-project-root 'safe-local-variable
101 #'(lambda (v) (assq v php-project-available-root-files)))) 106 #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))))
102 107
103;;;###autoload 108;;;###autoload
104(progn 109(progn
@@ -177,15 +182,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
177;;;###autoload 182;;;###autoload
178(defun php-project-get-root-dir () 183(defun php-project-get-root-dir ()
179 "Return path to current PHP project." 184 "Return path to current PHP project."
180 (let ((detect-method 185 (if (and (stringp php-project-root) (file-directory-p php-project-root))
181 (cond 186 php-project-root
182 ((stringp php-project-root) (list php-project-root)) 187 (let ((detect-method
183 ((eq php-project-root 'auto) 188 (cond
184 (cl-loop for m in php-project-available-root-files 189 ((stringp php-project-root) (list php-project-root))
185 append (cdr m))) 190 ((eq php-project-root 'auto)
186 (t (cdr-safe (assq php-project-root php-project-available-root-files)))))) 191 (cl-loop for m in php-project-available-root-files
187 (cl-loop for m in detect-method 192 append (cdr m)))
188 thereis (locate-dominating-file default-directory m)))) 193 (t (cdr-safe (assq php-project-root php-project-available-root-files))))))
194 (cl-loop for m in detect-method
195 thereis (locate-dominating-file default-directory m)))))
189 196
190(provide 'php-project) 197(provide 'php-project)
191;;; php-project.el ends here 198;;; php-project.el ends here