Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command history in interpreters in emacs

Inside emacs I am running interpreters for several different languages (python, R, lisp, ...). When I run the interpreters through the terminal in most cases I can use the up arrow to see the last command or line of code that I entered. I no longer have this functionality when I am running the interpreters in emacs. How can I achieve this functionality?

  1. How can I access the command history from the interpreter inside emacs?
  2. Can I do this generally for language X?

At the moment I need to use python, so if anyone knows how to do this specifically with the python interpreter in emacs please let me know!

like image 450
CodeKingPlusPlus Avatar asked Jun 11 '13 14:06

CodeKingPlusPlus


People also ask

Where is Python command history stored?

The History Log is stored in the . spyder-py3 (Python 3) or spyder (Python 2) directory in your user home folder (by default, C:/Users/username on Windows, /Users/username for macOS, and typically /home/username on GNU/Linux).

How to execute code in Emacs?

To execute a file of Emacs Lisp code, use M-x load-file . This command reads a file name using the minibuffer and then executes the contents of that file as Lisp code. It is not necessary to visit the file first; in any case, this command reads the file as found on disk, not text in an Emacs buffer.

What is Emacs shell?

Eshell is a shell-like command interpreter implemented in Emacs Lisp. It invokes no external processes except for those requested by the user.


1 Answers

You can use M-p or Ctrl-up to get to the previous command. The complementary keys M-n or Ctrl-down will get you the next command in history.

Check out Emacs' manual page on the shell history ring.

like image 200
djf Avatar answered Oct 06 '22 23:10

djf