My theory for why these files are left behind when using the hook is the error call in elixir-format--failed-to-format. Per the Emacs documentation:
Error processing normally aborts all or part of the running program and returns to a point that is set up to handle the error.
When elixir-format is called interactively, the error call in elixir-format--failed-to-format function is not invoked, which explains why the files are not left behind in that case.
My fix here was just to wrap the piece that sometimes errors in an unwind-protect and have (delete-file ...) and (kill-buffer ...) as unwind forms.
Fixes #497
My theory for why these files are left behind when using the hook is the
error
call inelixir-format--failed-to-format
. Per the Emacs documentation:When
elixir-format
is called interactively, theerror
call inelixir-format--failed-to-format
function is not invoked, which explains why the files are not left behind in that case.My fix here was just to wrap the piece that sometimes errors in an
unwind-protect
and have(delete-file ...)
and(kill-buffer ...)
as unwind forms.