Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add php-project-project-find-function compatible with project-find-functions #693

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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