From e9ab1da1b24d9232db55828270c488a9f8c455b8 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Tue, 20 Aug 2019 15:02:47 +0900 Subject: [PATCH] Add named phpactor-reset-executable for hook Remove self from compilation-finish-functions instead local hook --- phpactor.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpactor.el b/phpactor.el index 2f1a3e6..b9d8746 100644 --- a/phpactor.el +++ b/phpactor.el @@ -127,6 +127,12 @@ of GitHub.") :type '(string) :safe #'stringp :group 'phpactor) + +(defun phpactor-reset-executable (&rest _args) + "Reset `phpactor-executable' variable by `phpactor--find-executable'." + (prog1 + (setq phpactor-executable (phpactor--find-executable)) + (remove-hook 'compilation-finish-functions #'phpactor-reset-executable))) ;; Utility functions @@ -152,7 +158,7 @@ of GitHub.") (php-runtime-quote-string (concat directory file)) (php-runtime-quote-string (concat phpactor-install-directory file))) do (php-runtime-expr code)) - (add-hook 'compilation-finish-functions (lambda (buffer desc) (setq phpactor-executable (phpactor--find-executable)))) + (add-hook 'compilation-finish-functions 'phpactor-reset-executable) (composer nil "install" "--no-dev"))) (defalias 'phpactor-update #'phpactor-install-or-update)