From 3071e5dc747604d9161dde75fb4ac49ed3da883d Mon Sep 17 00:00:00 2001 From: Naoya Yamashita Date: Tue, 15 Sep 2020 00:19:25 +0900 Subject: [PATCH 1/2] search phpactor executable from exec-path --- phpactor.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpactor.el b/phpactor.el index 50e0d4d..23552fd 100644 --- a/phpactor.el +++ b/phpactor.el @@ -117,7 +117,15 @@ of GitHub.") (defun phpactor--find-executable () "Return path to Phpactor executable file." - (let ((vendor-executable (f-join phpactor-install-directory "vendor/bin/phpactor"))) + (let* (target + (vendor-executable + (cond + ((progn + (setq target (f-join phpactor-install-directory "vendor/bin/phpactor")) + (file-executable-p target)) + target) + ((setq target (executable-find "phpactor")) + target)))) (if (file-exists-p vendor-executable) vendor-executable (warn "Phpactor not found. Please run `phpactor-install-or-update' command") From d9070529c3b7fa129becaafa3f5fb092720d10d1 Mon Sep 17 00:00:00 2001 From: Naoya Yamashita Date: Tue, 15 Sep 2020 00:20:06 +0900 Subject: [PATCH 2/2] refactor phpactor missing warning --- phpactor.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/phpactor.el b/phpactor.el index 23552fd..69a10f2 100644 --- a/phpactor.el +++ b/phpactor.el @@ -126,10 +126,9 @@ of GitHub.") target) ((setq target (executable-find "phpactor")) target)))) - (if (file-exists-p vendor-executable) - vendor-executable - (warn "Phpactor not found. Please run `phpactor-install-or-update' command") - nil))) + (unless vendor-executable + (warn "Phpactor not found. Please run `phpactor-install-or-update' command")) + vendor-executable)) (defcustom phpactor-executable (phpactor--find-executable) "Path to phpactor executable.