Skip to content

Commit c42d582

Browse files
authored
Merge pull request #132 from emacs-php/fix/hook-named-function
Add named phpactor-reset-executable for hook
2 parents c9ca4c2 + e9ab1da commit c42d582

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

phpactor.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ of GitHub.")
127127
:type '(string)
128128
:safe #'stringp
129129
:group 'phpactor)
130+
131+
(defun phpactor-reset-executable (&rest _args)
132+
"Reset `phpactor-executable' variable by `phpactor--find-executable'."
133+
(prog1
134+
(setq phpactor-executable (phpactor--find-executable))
135+
(remove-hook 'compilation-finish-functions #'phpactor-reset-executable)))
130136

131137
;; Utility functions
132138

@@ -152,7 +158,7 @@ of GitHub.")
152158
(php-runtime-quote-string (concat directory file))
153159
(php-runtime-quote-string (concat phpactor-install-directory file)))
154160
do (php-runtime-expr code))
155-
(add-hook 'compilation-finish-functions (lambda (buffer desc) (setq phpactor-executable (phpactor--find-executable))))
161+
(add-hook 'compilation-finish-functions 'phpactor-reset-executable)
156162
(composer nil "install" "--no-dev")))
157163

158164
(defalias 'phpactor-update #'phpactor-install-or-update)

0 commit comments

Comments
 (0)