emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/php-mode 5f26bec865 2/2: Merge pull request #693 from emac


From: ELPA Syncer
Subject: [nongnu] elpa/php-mode 5f26bec865 2/2: Merge pull request #693 from emacs-php/feature/php-project-project-find-function
Date: Thu, 20 Jan 2022 15:58:31 -0500 (EST)

branch: elpa/php-mode
commit 5f26bec865ee159dc30d3922f17bc42adfcfed50
Merge: 010d0f6987 fe4abfc719
Author: USAMI Kenta <tadsan@pixiv.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #693 from 
emacs-php/feature/php-project-project-find-function
    
    Add php-project-project-find-function compatible with project-find-functions
---
 CHANGELOG.md        |  1 +
 lisp/php-project.el | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 666ee46ebb..31960fd0c3 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 b611171924..3ed761eb28 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]