Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Interpretor in Emacs, removing the input reprinting

I am quite new to Emacs.

When running Emacs' python interpretor, it does

>>> print(24)
print(24)
24

Is there a way I can prevent the re-printing of my input and make it as below?

>>> print(24)
24

Thank you so much :)

like image 513
Maurice Avatar asked Oct 11 '25 22:10

Maurice


1 Answers

The trick here is that the buffer you're running the python process in doesn't have comint-process-echoes set.

There are a couple of other questions that are relevant to your problem.

How to turn off the echoing

How to set emacs so it always turns off echoing

But the basic gist is you need to customize the value of comint-process-echoes. If you are new to emacs, you might not know that most customizations are done using emacs lisp, where setting a variable looks something like this:

(setq variable-name new-value)

In this case, the variable we want is comint-process-echoes so the lisp we want to evaluate is:

(setq comint-process-echoes t)

Where t is lisp-speak for "true."

So, to borrow the advice of the first link above, to actually tell emacs to evaluate this lisp code, use the M-: (meta+colon) command. From the python shell buffer, type meta+colon, then type (setq comint-process-echoes t) then hit return. Your problem should be solved.

like image 97
chigby Avatar answered Oct 14 '25 16:10

chigby