With some regularity, I am using bash with M-x shell, and out of muscle memory I hit C-c C-c, with dramatic results:

  • the comint prompt streams a long error message with a large number of escaped characters;
  • several files are created in the working directory with only escaped characters in the name.

Is there any way to send a kill signal to the prompt from within comint-mode, similar to what is triggered in a normal bash terminal with C-c C-c?

Edit: this is in Emacs for OS X Modified, and it only happens sometimes when I press C-c C-c in shell-mode

  • 3
    This isn't normal. C-c C-c in shell-mode sends comint-interrupt-subjob, which does the same thing as C-c in a standard shell. I can confirm this on vanilla Emacs (started via emacs -Q), none of the behaviours you describe occur. I suspect it may be due to the particular program you are trying to interrupt doing something strange. First thing to check: start emacs with emacs -Q and see if you can reproduce the problem. If you can't, the problem is in your init file. – Tyler Jan 9 '18 at 18:36
  • @Tyler thanks for the suggestions. It happens sporadically enough that I can't reliably reproduce it, but I'm now pretty confident it's a combination of ZSH, $TERM / $SHELL, and color codes...well outside the realm of shell-mode's responsibility. – Henry Jan 12 '18 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.