Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete -emacs-elixir-format files when elixir-format is called uninteractively #498

Merged

Conversation

J3RN
Copy link
Contributor

@J3RN J3RN commented Feb 4, 2023

Fixes #497

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.

@J3RN J3RN changed the title Delete -emacs-elixir-format files Delete -emacs-elixir-format files when elixir-format is called uninteractively Feb 4, 2023
@J3RN J3RN force-pushed the delete-emacs-elixir-format-files branch from d9306e8 to 3d977d8 Compare February 5, 2023 19:36
mjrusso added a commit to mjrusso/.emacs.d that referenced this pull request Feb 24, 2023
("Delete -emacs-elixir-format files when elixir-format is called
uninteractively": elixir-editors/emacs-elixir#498)
Copy link
Contributor

@victorolinasc victorolinasc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome :) Thanks!

@victorolinasc victorolinasc merged commit 6c7f2b2 into elixir-editors:master Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-emacs-elixir-format.ex files left behind when using format hook
2 participants