Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Interpreter in Emacs repeats lines

Tags:

python

emacs

What is happening:

>>> 2 * 10
2 * 10
20
>>> 

What I want to happen:

>>> 2 * 10
20
>>> 

Does anyone know why the command is printed out before being executed and how to stop it from doing that? I can't find any documentation about this. I'm using Emacs 23 on Mac OS X with Python 2.7.

like image 374
methodmain Avatar asked Nov 09 '11 05:11

methodmain


People also ask

How to use emacs for Python development?

So, we need to add some commands to this file for Emacs to be used for Python Development. Firstly, open Emacs and hit Ctrl + X, followed by Ctrl + F and then enter ~/.emacs to open the init file. Next, add the following lines of code to your init file:

How do I use pstats in Emacs?

The Python pstats module provides an interactive tool when a script from a regular shell in Emacs; it can also be used in a Python shell running in Emacs. You can open an interactive Python shell with ‘run-python’ (“C-c C-p”), and send code for execution by the shell process using the ‘python-shell-send-*’ functions.

What is elpy in Emacs?

The elpy (Emacs Lisp Python Environment) package provides us with a near complete set of Python IDE features, including: Automatic Indentation, Syntax Highlighting, Auto-Completion, Syntax Checking, Python REPL Integration, Virtual Environment Support, and Much more!

Do you break the line after [ in Emacs?

In this special case the ( and the [ that follow join are adjacent, so I would break the line after [. (In the more typical case, I would break the line at the first ( or [ character.) This seems to me like something that emacs could do, and probably does (somewhere), and it would save me a whole lotta keystrokes.


1 Answers

I don't use python, but I would guess that the python feature you are using has set the variable comint-process-echoes incorrectly. Whatever the value in your buffer is, just reverse the boolean value.

Comint is a support library in Emacs for running inferior processes in Emacs. It interacts with the prompts, and the python shell (or M-x shell) needs to be told about the echo feature.

In your shell buffer with the problem, do:

M-: (setq comint-process-echoes t)  ;; or nil
like image 59
Eric Avatar answered Oct 24 '22 11:10

Eric