4

How would I open a second python interpreter in emacs? I am using emacs 24.3 and Ubuntu 12.04 LTS. I have opened the SQL interpreter/program via a prefix argument of 2. I tried this with python and it did not work.

Any suggestions and ideas are welcome. The mode in my current python interpreter buffer says: Inferior Python: run Shell-Compile I have downloaded python-mode 6.10 from ELPA the emacs package manager.

Thanks for all the help!

2
  • isn't it usually just M-x run-python? Commented Aug 21, 2013 at 2:02
  • That takes me to my already open python interpreter. My already open python interpreter is running a program that takes a long time to process... Commented Aug 21, 2013 at 2:13

2 Answers 2

3

M-x describe-function (RET) run-python:

run-python is an interactive compiled Lisp function in `python.el'.

(run-python &optional CMD NOSHOW NEW)

Run an inferior Python process, input and output via buffer Python. CMD is the Python command to run. NOSHOW non-nil means don't show the buffer automatically.

Interactively, a prefix arg means to prompt for the initial Python command line (default is `python-command').

A new process is started if one isn't running attached to python-buffer', or if called from Lisp with non-nil arg NEW. Otherwise, if a process is already running inpython-buffer', switch to that buffer.

...

In the *scratch* buffer:

(run-python nil nil 't)

That will give you a new Inferior Python process.

You could code up a new interactive emacs command in your .emacs file, something like:

(defun my-run-python ()
  (interactive)
  (run-python nil nil 't))
Sign up to request clarification or add additional context in comments.

4 Comments

How do I create the scratch buffer if I already deleted it?
Why delete it? C-x b *scratch*, and then say yes to create it. Alternatively, I think you can do M-x lisp-interaction-mode in any buffer to make it into an equivalent buffer. BTW, put your cursor at the end of your last right paren in your lisp expression and C-x C-e to evaluate the expression.
That didn't work... It just evaluates to nil in the mini-buffer.
(run-python nil 't 't) worked for modern emacs
2

C-u M-x python

BTW your python-mode version is outdated. Recommend to fetch a new one doing

bzr branch lp:python-mode

or visit

https://launchpad.net/python-mode

2 Comments

@CodeKingPlusPlus el-get, https://github.com/dimitri/el-get distributes a reasonably updated version. Also you might replace old python-mode.el by hand.
@CodeKingPlusPlus An emacs package manager, check out the link given.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.