jscheid/prettier.el

Emacs Crashes when saving a file on the last line in prettier mode

Closed this issue · 13 comments

Describe the bug
Ok, a small disclaimer to start of with: I don't know if this problem is caused by prettier.el. But I don't know where else to start, and it seemed logical to start here, because the problem seems to be related to prettier.el, which of course does not mean it is caused by prettier.el. In other words, I would not be surprised if this is not at all caused by prettier.el:)

First things first. I'm on:

  • Linux mint 20.1
  • Linux Kernel 5.4
  • Emacs 26.3
  • prettier.el 1.1.0

The title pretty much explains the problem: Emacs crashes(or is running in some kind of infinite loop) when I am using prettier.el (either in an html, css or javascript file) and saving a file with the cursor the last line of said file. I noticed that it doesn't crash when I switch prettier.el off. My own assessment is that this is either something in prettier.el, or perhaps some kind of conflict issue with another package which I haven't been able to find out. When I press ctrl+g, I regain control of emacs however.

Link to M-x prettier-info output
https://gist.github.com/MPE2016/dc6cdbf92dabcaff0a39ba0d69c1f909

To Reproduce
See bug description

Expected behavior
No crash of emacs.

Additional context
not applicable

It does sound like it's this packet to blame. Is there anything interesting in buffer *prettier (local)*?

And could you attach one of the files it happens with?

Also, a copy of the output of M-x describe-mode (in a buffer where you have the problem) would be useful.

Let's take a step back: when you're not on the last line, does prettier-mode work? Is it reformatting the buffer on save? If it does, then you should definitely have a buffer whose name starts with *prettier.

When you say "I noticed that it doesn't crash when I switch prettier.el off", how do you switch it off? By disabling prettier-mode?

Interesting. Can you send me the describe-mode output please and I'll have closer look tomorrow.

Thanks.

Could you run this expression: (setq prettier-keep-server-buffer-flag t) and then try again? This time the *prettier (local)* buffer shouldn't vanish after the crash and hopefully there's going to be something useful in it.

That bug has long been fixed. You said you're using prettier.el 1.1 but in your prettier-info I can see that it's in fact 1.0. Upgrade to the latest and you should be fine.

No problem, glad it's working now.