mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
Log an error when a formatter's executable is not found (#269)
I was trying to set up a new formatter and it wasn't in my exec-path, so it wasn't running anything. But there was no message in the apheleia logs, even with `apheleia-log-debug-info` enabled. This adds a log entry when the executable is not found. Hopefully the formatting is okay - I think Apheleia re-indented it so hopefully that's good. Fixes #268 --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This commit is contained in:
parent
8f512dba3e
commit
efb9992c00
1 changed files with 22 additions and 18 deletions
|
@ -980,13 +980,14 @@ purposes."
|
||||||
(let ((load-suffixes '(".el")))
|
(let ((load-suffixes '(".el")))
|
||||||
(locate-library "apheleia"))))))
|
(locate-library "apheleia"))))))
|
||||||
exec-path)))
|
exec-path)))
|
||||||
(when (executable-find (apheleia-formatter--arg1 ctx)
|
(if (executable-find (apheleia-formatter--arg1 ctx)
|
||||||
(eq apheleia-remote-algorithm 'remote))
|
(eq apheleia-remote-algorithm 'remote))
|
||||||
(apheleia--execute-formatter-process
|
(apheleia--execute-formatter-process
|
||||||
:ctx ctx
|
:ctx ctx
|
||||||
:callback
|
:callback
|
||||||
(lambda (stdout)
|
(lambda (stdout)
|
||||||
(when-let ((output-fname (apheleia-formatter--output-fname ctx)))
|
(when-let
|
||||||
|
((output-fname (apheleia-formatter--output-fname ctx)))
|
||||||
;; Load output-fname contents into the stdout buffer.
|
;; Load output-fname contents into the stdout buffer.
|
||||||
(with-current-buffer stdout
|
(with-current-buffer stdout
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
|
@ -997,7 +998,10 @@ purposes."
|
||||||
(dolist (fname (list (apheleia-formatter--input-fname ctx)
|
(dolist (fname (list (apheleia-formatter--input-fname ctx)
|
||||||
(apheleia-formatter--output-fname ctx)))
|
(apheleia-formatter--output-fname ctx)))
|
||||||
(when fname
|
(when fname
|
||||||
(ignore-errors (delete-file fname))))))))))
|
(ignore-errors (delete-file fname))))))
|
||||||
|
(apheleia--log
|
||||||
|
'process
|
||||||
|
"Could not find executable for formatter %s, skipping" formatter)))))
|
||||||
|
|
||||||
(defun apheleia--run-formatter-function
|
(defun apheleia--run-formatter-function
|
||||||
(func buffer remote callback stdin formatter)
|
(func buffer remote callback stdin formatter)
|
||||||
|
|
Loading…
Add table
Reference in a new issue