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

Impl interop to Projectile #608

Merged
merged 1 commit into from
Jan 21, 2020
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 Cask
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@

(development
(depends-on "pkg-info")
(depends-on "projectile")
(depends-on "shut-up"))
15 changes: 15 additions & 0 deletions php-project.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

;;; Code:
(require 'cl-lib)
(require 'projectile nil t)

;; Constants
(defconst php-project-composer-autoloader "vendor/autoload.php")
Expand All @@ -84,6 +85,12 @@
:tag "PHP Project Auto Detect Etags File"
:group 'php-project
:type 'boolean)

(defcustom php-project-use-projectile-to-detect-root nil
"If `T' and projectile-mode is activated, use Projectile for root detection."
:tag "PHP Project Use Projectile To Detect Root"
:group 'php-project
:type 'boolean)

;; Variables
(defvar php-project-available-root-files
Expand Down Expand Up @@ -269,6 +276,14 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
"Return path to current PHP project."
(if (and (stringp php-project-root) (file-directory-p php-project-root))
php-project-root
(php-project--detect-root-dir)))

(defun php-project--detect-root-dir ()
"Return detected project root."
(if (and php-project-use-projectile-to-detect-root
(bound-and-true-p projectile-mode)
(fboundp 'projectile-project-root))
(projectile-project-root default-directory)
(let ((detect-method
(cond
((stringp php-project-root) (list php-project-root))
Expand Down