Skip to content

Commit

Permalink
Merge pull request #168 from emacs-php/feature/php-project-as-optional
Browse files Browse the repository at this point in the history
Make 'php-project feature an optional dependency
  • Loading branch information
zonuexe authored Apr 7, 2024
2 parents b9713a1 + f8a071b commit 1916e35
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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."
Expand Down

0 comments on commit 1916e35

Please sign in to comment.