Skip to content

Commit cc9ef51

Browse files
committed
Add php-project-project-find-function compatible with project-find-functions
1 parent 6115454 commit cc9ef51

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
1212
* Add `php-imenu-generic-expression-default` for default value or `php-imenu-generic-expression`
1313
* Add `php-imenu-generic-expression-legacy` for compatibility
1414
* Add `php-imenu-generic-expression-simple` for simple display
15+
* Add `php-project-project-find-function` compatible with `project-find-functions`
1516

1617
### Changed
1718

Diff for: lisp/php-project.el

+11
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
282282
php-project-root
283283
(php-project--detect-root-dir)))
284284

285+
;;;###autoload
286+
(defun php-project-project-find-function (dir)
287+
"Return path to current PHP project from DIR.
288+
289+
This function is compatible with `project-find-functions'."
290+
(let ((default-directory dir))
291+
(when-let (root (php-project-get-root-dir))
292+
(if (file-exists-p (expand-file-name ".git" root))
293+
(cons 'vc root)
294+
(cons 'transient root)))))
295+
285296
(defun php-project--detect-root-dir ()
286297
"Return detected project root."
287298
(if (and php-project-use-projectile-to-detect-root

0 commit comments

Comments
 (0)