diff --git a/CHANGELOG.md b/CHANGELOG.md index 666ee46e..31960fd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this * Add `php-imenu-generic-expression-default` for default value or `php-imenu-generic-expression` * Add `php-imenu-generic-expression-legacy` for compatibility * Add `php-imenu-generic-expression-simple` for simple display + * Add `php-project-project-find-function` compatible with `project-find-functions` ### Changed diff --git a/lisp/php-project.el b/lisp/php-project.el index b6111719..3ed761eb 100644 --- a/lisp/php-project.el +++ b/lisp/php-project.el @@ -282,6 +282,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") php-project-root (php-project--detect-root-dir))) +;;;###autoload +(defun php-project-project-find-function (dir) + "Return path to current PHP project from DIR. + +This function is compatible with `project-find-functions'." + (let ((default-directory dir)) + (when-let (root (php-project-get-root-dir)) + (if (file-exists-p (expand-file-name ".git" root)) + (cons 'vc root) + (cons 'transient root))))) + (defun php-project--detect-root-dir () "Return detected project root." (if (and php-project-use-projectile-to-detect-root