1

I'm editing JavaScript files quite a bit and I have prettier installed and prettier-mode and when I load files and make changes it runs, changes the layout and saves them as expected.

However, if I create a new JavaScript file with any amount of code (even something as trivial as let A=42) it will frequently, but not always, hang indefinitely.

If I hit C-g, toggle prettier-mode, save the file, close the buffer and reload it, then there's a tiny delay during which *Messages* says Prettier syncing config, and everything goes back to working.

However it's rather annoying that it doesn't just work in the first place. It doesn't do this on empty files but if I then add content and resave it will hang.

If I move my .emacs file out of the way and start with an empty config then I still get the same issue but in this case I have to manually enable prettier-mode since I'm missing the line "(add-hook `js-mode-hook 'prettier-mode)"

If I run with emacs -Q I can't even enable prettier-mode so that's not much use at all.

I'm running prettier 2.3.2 and GNU Emacs 27.1 (build 2, x86_64-pc-linux-gnu) of 2020-10-17

4
  • 1
    Do you see the same problem if you start Emacs with emacs -Q (no init file)? If not, bisect your init file to find the culprit. If yes, please show a step-by-step recipe to repro the problem, saying what you see at each step, and what you expected to see instead. Thx.
    – Drew
    Commented Mar 7, 2022 at 16:51
  • Yes without a .emacs file but unreproducible with emacs -Q. I've edited the question with more info. Thanks. Commented Mar 7, 2022 at 17:02
  • 1
    I presume that prettier is a GIthub project - correct? If so, have you tried opening an issue there?
    – NickD
    Commented Mar 7, 2022 at 17:08
  • 1
    Try to give a recipe to repro the problem, starting with emacs -Q and then loading the prettier package, etc.
    – Drew
    Commented Mar 7, 2022 at 22:03

1 Answer 1

1

Turns out I had two versions of prettier-mode installed in .emacs.d/elpa/. As part of trying to reproduce the steps, I corrected this and the problem went away. As to how it got two different versions installed or why this would produce random hanging, I have no idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.