Skip to content
Merged
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
19 changes: 13 additions & 6 deletions phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ of GitHub.")
(let ((vendor-executable (f-join phpactor-install-directory "vendor/bin/phpactor")))
(if (file-exists-p vendor-executable)
vendor-executable
(warn "Phpactor not found. Please run phpactor-install-or-update")
(warn "Phpactor not found. Please run `phpactor-install-or-update' command")
nil)))

(defcustom phpactor-executable (phpactor--find-executable)
(defcustom phpactor-executable (phpactor--find-executable)
"Path to phpactor executable.
It is recommemded not to customize this, but if you do, you'll
have to ensure a compatible version of phpactor is used."
:type '(string)
It is recommemded not to customize this, but if you do, you'll
have to ensure a compatible version of phpactor is used."
:type 'string
:safe #'stringp
:group 'phpactor)

Expand All @@ -133,6 +133,13 @@ of GitHub.")
(prog1
(setq phpactor-executable (phpactor--find-executable))
(remove-hook 'compilation-finish-functions #'phpactor-reset-executable)))

(defun phpactor-ensure-executable ()
"Ensure `phpactor' command installed."
(interactive)
(unless (and phpactor-executable (file-exists-p phpactor-executable))
(phpactor-install-or-update)
(phpactor-reset-executable)))

;; Utility functions

Expand Down Expand Up @@ -550,7 +557,7 @@ function."
(when (and version (not (equal phpactor--supported-rpc-version version)))
(if phpactor-executable
(error "Phpactor uses rpc protocol %s but this package requires %s" version phpactor--supported-rpc-version)
(error "Phpactor should be upgraded. Please run phpactor-install-or-update")))
(user-error "Phpactor should be upgraded. Please run `phpactor-install-or-update' command")))
(phpactor--add-history 'phpactor-action-dispatch (list :action action :parameters parameters :version version))
(let ((func (cdr-safe (assq (intern action) phpactor-action-table))))
(if func
Expand Down