From 788b409a356d86a4af0cb0f222b586871eea24af Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Tue, 20 Aug 2019 14:43:49 +0900 Subject: [PATCH 1/3] Fix phpactor-executable indentation and type notation --- phpactor.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpactor.el b/phpactor.el index b9d8746..d6de4e3 100644 --- a/phpactor.el +++ b/phpactor.el @@ -120,11 +120,11 @@ of GitHub.") (warn "Phpactor not found. Please run phpactor-install-or-update") 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) From 193e27b87b855facb67ee1d725c847006cfd0787 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Tue, 20 Aug 2019 14:49:36 +0900 Subject: [PATCH 2/3] Unify method error display to users to "user-error" function --- phpactor.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpactor.el b/phpactor.el index d6de4e3..6925bdf 100644 --- a/phpactor.el +++ b/phpactor.el @@ -117,7 +117,7 @@ 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) @@ -550,7 +550,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 From 1ca4885b25c0f92816f9dcef981ca46c67bbb52b Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Tue, 20 Aug 2019 16:37:44 +0900 Subject: [PATCH 3/3] Add phpactor-ensure-executable command/function --- phpactor.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpactor.el b/phpactor.el index 6925bdf..fadf597 100644 --- a/phpactor.el +++ b/phpactor.el @@ -133,6 +133,13 @@ have to ensure a compatible version of phpactor is used." (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