2

When I start python-shell (or even just start python from M-x shell), Emacs gives the expected prompt:

bash-3.2$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

But when I type something at the prompt and press RET, the cursor moves down a line but the command is not executed. The only commands I can get the subprocess to respond to are interrupts like C-C C-c. After an interrupt, another prompt (>>>) appears and I can use M-n and M-p to navigate the lines I "entered" earlier.

>>> test
hmmm, definitely pressed enter there
  C-c C-c
KeyboardInterrupt
>>> 

Curiously, this occurs both in Aquaemacs and in emacs -nw. I've tried moving my .emacs and .emacs.d files and the behavior is the same. Any ideas on what might be causing this?

yannis
  • 6,215
  • 5
  • 39
  • 49
ine
  • 14,014
  • 8
  • 55
  • 80

1 Answers1

3

After you do "M-x shell" and then "python RET", do "C-h k RET" and then what is displayed? the Help buffer should say that "comint-send-input" is the command that is executed for RET. If it isn't showing "comint-send-input" as the command executed by "RET" then there is probably something in one of your init files (the .emacs file isn't the only init file) that is overriding this binding. So, then try running emacs with "emacs -nw -q -no-site-file" and repeat the above. If it wasn't displaying "comint-send-input" previously and is displaying "comint-send-input" now, then it's definitely something in one of your init files. Look at both your local (http://www.gnu.org/software/emacs/emacs-lisp-intro/elisp/Init-File.html#Init-File) and site-wide (http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/Site_002dwide-Init.html#Site_002dwide-Init) init files to try to find the culprit. If it's not obvious after examining the files, your best bet is to rename any init files you find and gradually re-introduce the code until you find what is causing the "breakage".

zev
  • 3,480
  • 18
  • 13
  • Hmmm, 'comint-send-input' is still the command for both emacs and the no-site-file option. Added some details to the original post. Definitely a puzzle. – ine Sep 27 '11 at 01:20
  • 1
    This is very odd. Could it be something in your bash init files that is causing the problem? Try renaming your .bashrc and .bash_profile init files to see if that helps. You could also try running ansi-term instead of shell to see if the behavior is different. Also try running an alternative shell (e.g. - "sh" instead of "bash") to see if this has any effect. – zev Sep 27 '11 at 15:38
  • zev! genius! I forgot I had recently added 'Control-j: menu-complete' and 'Control-h: menu-complete-backward' to my ~/.inputrc. Removing them fixed the issue. – ine Sep 27 '11 at 18:43
  • Glad to hear you found the cause! These types of problems can be a real pain to isolate. – zev Sep 27 '11 at 19:02
  • @ine it maybe kind of late to ask this? but why did having bindings for C-j or C-h break this for you? I ran into the same issue and fixed it the same way. I'm just curious. – Mohsin Kale Apr 22 '20 at 19:23