2

This question already has an answer here:

I try to comments 1.4K+ lines in a C++ function by using M-; or rectangle insert string //.

Wait for several minutes, Emacs still no respond. I have to kill Emacs.

In this case, how could I locate what cause the Emacs use 100% CPU and looks like do nothing?

Emacs: 25.0

OS: Ubuntu 14.04

marked as duplicate by Gilles Apr 21 '16 at 9:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Do you see the same slow response if you use M-x comment-region (after activating the region) instead of M-;? If not, then use it. – Drew Aug 11 '15 at 14:31
  • Most likely something deep within cc-mode. – wasamasa Apr 21 '16 at 11:36
4

Little-known trick... You can send an interrupting debug signal to Emacs with kill/killall/pkill.

pkill -USR2 emacs

When sent to Emacs, the USR2 kill signal will interrupt whatever Emacs is doing and drop you to a debugger. From there, you can likely tell what is causing the hang from the stack trace.

  • It always stop at magit-pre-command-hook. – Enze Chi Dec 20 '15 at 23:15

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