From f8a071b424b574d89d786c5e61a8181eef30ead1 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Sun, 7 Apr 2024 19:43:04 +0900 Subject: [PATCH] Make 'php-project feature an optional dependency --- phpactor.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpactor.el b/phpactor.el index 7730ee0..ae75333 100644 --- a/phpactor.el +++ b/phpactor.el @@ -48,7 +48,7 @@ (require 'cl-lib) (require 'f) (require 'json) -(require 'php-project) +(require 'php-project nil t) (require 'php-runtime) (require 'ring) (require 'subr-x) @@ -57,6 +57,7 @@ (require 'xref) (require 'smart-jump nil t) +(declare-function php-project-get-root-dir "ext:php-project") (declare-function smart-jump-register "ext:smart-jump") ;; Custom variables @@ -202,7 +203,11 @@ have to ensure a compatible version of phpactor is used." "Return working directory of Phpactor." (directory-file-name (expand-file-name - (or (php-project-get-root-dir) default-directory)))) + (or (if (fboundp 'php-project-get-root-dir) + (php-project-get-root-dir) + (or (locate-dominating-file default-directory ".phpactor.yml") + (locate-dominating-file default-directory "composer.json"))) + default-directory)))) (defun phpactor--expand-local-file-name (name) "Expand file name by NAME."