I use Emacs Dired to manage files. Accidentally, I hit Enter on an image file, Emacs tries to open the image and stop response. Is there a way to kill this process?

(Since I am running other processes at the same time, I don't want to restart Emacs.)

Edit: Is there a way to list all the processes within Emacs and kill a certain one like in shell: kill -9 process-id?

Edit 2: Although very slow, I managed to press C-x C-b to list all the buffers, and d mark the buffer caused Emacs no-response, x to execute delete. It succeed.

This only works as long as Emacs could response to my key. I really don't know what to do if I can't list all the buffers.

  • 1
    Did you hold C-g for a while?
    – Tu Do
    Commented Dec 15, 2014 at 14:50
  • @TuDo Yes, I did. It didn't work. I also tried C-x k, I saw this in mini-buffer: Error in nil (nil): (quit)
    – Nick
    Commented Dec 15, 2014 at 14:54
  • 1
    Try C-x C-b C-x o d x.
    – abo-abo
    Commented Dec 15, 2014 at 15:03
  • @abo-abo Thank you. I tried almost the same approach and it worked.
    – Nick
    Commented Dec 15, 2014 at 15:06

2 Answers 2


I've personally experienced hangs that cannot be broken by any number of C-g presses.

A more forceful method on UNIX OSs is to send Emacs a USR2 signal. Signal processing is a lot lower-level than keyboard input, and has a very good chance of unhanging Emacs. (I've never seen it fail)

$ killall -USR2 emacs 

Should do the trick. In addition USR2 creates a backtrace. If you don't want that, you might have some luck with the following (I haven't tested this, though):

(defun quit-on-usr2 ()
(global-set-key [signal usr2] #'quit-on-usr2)

Press C-g repeatably. The first time might be ignored, the second time it should do the trick. If that fails also try pressing ESC three times.

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