Because at times there have been bugs causing Emacs to loop without
quit-flag, a special feature causes Emacs to be suspended
immediately if you type a second C-g while the flag is already set,
so you can always get out of GNU Emacs. Normally Emacs recognizes and
quit-flag (and quits!) quickly enough to prevent this from
When you resume Emacs after a suspension caused by multiple C-g, it asks two questions before going back to what it had been doing:
Auto-save? (y or n) Abort (and dump core)? (y or n)
Answer each one with y or n followed by RET.
Saying y to `Auto-save?' causes immediate auto-saving of all modified buffers in which auto-saving is enabled.
Saying y to `Abort (and dump core)?' causes an illegal instruction to be
executed, dumping core. This is to enable a wizard to figure out why Emacs
was failing to quit in the first place. Execution does not continue
after a core dump. If you answer n, execution does continue. With
luck, GNU Emacs will ultimately check
quit-flag and quit normally.
If not, and you type another C-g, it is suspended again.
If Emacs is not really hung, just slow, you may invoke the double C-g feature without really meaning to. Then just resume and answer n to both questions, and you will arrive at your former state. Presumably the quit you requested will happen soon.
The double-C-g feature is turned off when Emacs is running under the X Window System, since you can use the window manager to kill Emacs or to create another window and run another program.