help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use a new buffer as Python shell?


From: Anders Munch
Subject: Re: How to use a new buffer as Python shell?
Date: Fri, 19 Aug 2022 09:48:20 +0000

edgar@openmail.cc wrote:

> What I would like is to have something like C-u C-c C-z or M-x run-new-python 
> (bogus function name) and get a prompt with the name of the new buffer, where 
> another interpreter is running, and which I can use to send lines of code 
> from the buffer with python-mode (the one from which the command 
> run-new-python was issued).

You are using python.el.  You may have more luck with python-mode.el.

C-u M-x py-shell RET
starts a new dedicated interpreter subshell.  I'm not sure exactly what that 
means, but it looks like it does much of what you want.  You use C-u once, and 
on subsequent subshell actions python-mode knows to use the same one from the 
same .py buffer. 

One caveat, it looks like you can't rename the buffer to something with the 
name of the originating buffer, because then you break the connection between 
the .py buffer and the subshell.
Some lisp hacking may be required to teach python-mode to prompt for a better 
subshell buffer name. 

regards, Anders




reply via email to

[Prev in Thread] Current Thread [Next in Thread]