1

Sometimes I'll open a large structured files (say, JSON) using json-mode, but the contents are malformed in some way (or something) and my Emacs session will suddenly spike my CPU to 100% and become unresponsive. Attempting to quit with C-g seems to do nothing.

Is there a graceful way to recover from such a situation? I usually just end up killing my entire emacs process and (in bad cases), editing the .emacs.desktop file to omit the problematic buffers.

I'm running GNU Emacs 28.2 on macOS 13.4.1.

Drew
  • 75,699
  • 9
  • 109
  • 225
Colin Fraizer
  • 740
  • 4
  • 12
  • 1
    Send in a bug report (`M-x report-emacs-bug`), attaching the file (somehow - maybe as a link if it is really big) that caused the problem. How big is the file? How much memory do you have on your system? – NickD Jul 07 '23 at 19:47

1 Answers1

1

You can try multiple C-g. Better yet, you can try ESC ESC ESC. And you can try C-]. And if Emacs is somewhat responsive you might be able to use M-x top-level, to exit all recursive edits.

See the Emacs manual, node Quitting and Aborting.

But if those attempts don't help then you need to kill the Emacs process, I believe. You do that from outside Emacs (using a shell command such as kill or a tool such as the MS Windows Task Manager).

Drew
  • 75,699
  • 9
  • 109
  • 225