This used to work just until recently, no idea what happened maybe an updated version of something is causing the problem.

In the shell buffer in Emacs, shell seems to stop working after SSH or launching R or Python. Say, if I launch R in shell buffer, R loads and when I enter any command and press Enter the cursor just moves to a new line, no command is sent. But the shell responds to C-c C-c and cancels the command and returns the prompt. I've tried issuing comint-send-input manually with M-x but that didn't work either. I've also tried this with "bare" Emacs, launching it with the -Q option, same.

For SSH, the problem occurs for bash but not for zsh.

I've just used zsh to launch R and I get "^G" inserted at the end of the command after pressing Enter. I think that is the problem. No idea how that occurs, if hadn't tried zsh with R never would have seen it as it doesn't print on screen with bash.

GNU Emacs 26.3 on Ubuntu 19.04

  • What happens when you do this without emacs, ie. ssh from an xterm?
    – jue
    Feb 12, 2020 at 15:05
  • No problem in terminal and no problem with term in Emacs.
    – Arktik
    Feb 12, 2020 at 15:51
  • 1
    This sounds weird. What happens if you ssh localhost? Whats the user shell (bash, tcsh, zsh, ...) on those servers, would it help to change that to another one?
    – jue
    Feb 12, 2020 at 20:42
  • bash everywhere. With localhost I've tried zsh and sh and both worked fine. So I guess it's bash related problem. But on remote server sh didn't worked, caused the same problem. Not sure this is the remote server problem, I think my Ubuntu got updated recently and something must have changed in my computer. I will try this from CentOS to CentOS tomorrow.
    – Arktik
    Feb 12, 2020 at 21:18
  • I've tried this with Emacs 24.3.1 on the server (CentOS to CentOS), I've connected to another server with shell. The same problem. Although these two servers share the same user home directory. I guess this is not an Emacs problem.
    – Arktik
    Feb 12, 2020 at 21:38

1 Answer 1


The problem was in the .inputrc file (vi mode) with the following line:

Control-j: history-search-forward

As suggested in the jue's comment below, the following solves the problem by restoring the C-j to its original binding for dumb terminals such as the shell mode in Emacs:

$if term=dumb 
    Control-j: accept-line
    Control-j: history-search-forward

I had the same .inputrc file everywhere, on the remote servers and the VM.

Big thanks to @jue!

  • 2
    I think emacs' shell is dumb so, working with $if term=dumb <NEWLINE> $else <YOURSETTINGS> $endif in your .inputrc could help.
    – jue
    Feb 13, 2020 at 20:44
  • You are gold! If yo put this as answer I will accept it! Anyway if it wasn't for your suggestion to try zsh I would have gone bananas! :)
    – Arktik
    Feb 13, 2020 at 21:02
  • 1
    Glad I could help and thanks. It is ok for me, when you make your answer the accepted and make it a bit more verbose. Maybe you get some upvotes. :)
    – jue
    Feb 14, 2020 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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