Skip to content

Commit

Permalink
Merge pull request #693 from emacs-php/feature/php-project-project-fi…
Browse files Browse the repository at this point in the history
…nd-function

Add php-project-project-find-function compatible with project-find-functions
  • Loading branch information
zonuexe authored Jan 20, 2022
2 parents 010d0f6 + fe4abfc commit 5f26bec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions lisp/php-project.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f26bec

Please sign in to comment.