Skip to content

Commit e9ab1da

Browse files
committed
Add named phpactor-reset-executable for hook
Remove self from compilation-finish-functions instead local hook
1 parent c9ca4c2 commit e9ab1da

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)