Take the 2-minute tour ×

So here's a technical question on how to exit from the current job of the inferior-python interpreter.

Normally, C-z does the trick if I run the interpreter in a regular command shell. This calls python exit and whatever is running stops. The interpreter process is still alive.

However, in emacs when I press C-z in the inferior shell it runs the undo command ( I use CUA-mode). If I disable CUA it will run the suspend-emacs command. What I want is to either unbind C-z completely or remap C-z to actually send an break signal to python just like it would do in a regular shell. I tried these brutal ways: (global-unset-key "\C-z") (global-unset-key [?\C-z])

None of them seem to work and C-z is still stuck as undo or suspend/inconify emacs.

I also tried regular signals: The only signal that I can send to the inferior shell is QUIT which is undesirable since that effectively kills the interpreter and its process(C-c C-). The signal STOP does not work.

Any ideas?

share|improve this question
add comment

1 Answer

When running an inferior process, you generally can send control sequences with the C-c prefix. With that in mind, try

C-c C-z

Which, for me, is bound to comint-stop-subjob.

share|improve this answer
C-c C-z doesn't do it for me but I realized C-c C-c breaks the job and keeps the interpreter alive. The reason I wasn't seeing this before was that I was running C/C++ modules using the python bindings and the "break" could not occur immediately; it had to wait until one C++ module finished executing –  octi Dec 8 '11 at 0:17
add comment

Your Answer


