[IPython-dev] Re: [SciPy-dev] Generic gui_thread + IPython: solution already exists!

Fernando Perez Fernando.Perez at colorado.edu
Mon Nov 15 18:27:24 CST 2004


Prabhu Ramachandran schrieb:

> BTW, Fernando, did you get to post the modified python-mode.el to the
> python-mode maintainers?

I sent it to the address you suggested, but I never heard back from anyone 
there.  I'm pasting below what I sent (without the attachment), perhaps you 
can bang on their door once more...

Best,

f.

-----------------------------------------------------------

Dear Python-mode maintainers,

the attached code is a patched version of python-mode 4.62, which incorporates
some changes to allow python-mode to support ipython[1] instead of the default
python interpreter in (X)emacs.  The work was done by Alex Schmolck and Prabhu
Ramachandran, and over time ipython has distributed this specially patched
version (since python-mode 4.22) to support ipytho's users.

It would be great if these changes could be folded into the python-mode
mainline code.  As far as I understand, the changes are fairly unobtrusive for
normal python users, and they would benefit greatly ipython's user base.

Best regards,

Fernando Perez

[1] http://ipython.scipy.org

Below follows the original message from Prabhu regarding this work.

-------- Original Message --------
Subject: Re: [IPython-user] ipython + emacs py-execute-region problem.
Date: Fri, 15 Oct 2004 15:23:25 +0530
From: Prabhu Ramachandran <Prabhu Ramachandran <prabhu_r at users.sourceforge.net>
To: Fernando Perez <Fernando.Perez at colorado.edu>
CC: Bo Peng <ben.bob at gmail.com>, ipython-user at scipy.net
References: <6ea7b543041014093632091eb at mail.gmail.com>
<416F6CB9.9040005 at colorado.edu>	<16751.32181.153111.604247 at monster.linux.in>
<416F7EEC.9010709 at colorado.edu>

 >>>>>>>>>> "FP" == Fernando Perez <Fernando.Perez at colorado.edu> writes:


      >> Well, I think Bo means that this does not seem to happen if he
      >> uses Alex's python-mode but does not use ipython.  So it
      >> appears that something funky happens when ipython is used.  I
      >> am not elisp guru either to be able to help.  When will Alex be
      >> back?

      FP> Oh, I misunderstood things then.  My point about the lag in
      FP> the ipython-compatible version of python-mode being an
      FP> unpleaseant situation remains, though.

      FP> I think Alex said a month, and he only left a few days ago.

Nevermind, I have fixed the problem.  I've updated python-mode.el to
the latest version (revision 4.62) available from CVS here:

   http://cvs.sourceforge.net/viewcvs.py/python-mode/python-mode/

I've retained Alex's fixes for IPython support in this version.  I
have also added a defcustom for py-shell-switch-buffers-on-execute
which defaults to true and will therefore switch buffers to the
py-shell when you execute a region.  If you turn it off it disables
this behavior.  So, switching the buffer was a feature and not a bug,
it appears.

So, to get Bo's desired behavior you simply need to do this in your
.xemacs/init.el:

   (require 'python-mode)
   (setq py-shell-switch-buffers-on-execute nil)
   (require 'ipython)


Please find attached a gzipped file containing the new-and-improved
python-mode.el.  I think you could consider sending this in to
python-mode at python.org.  I'm not doing it since I have already spent a
little too much time on this today.

cheers,
prabhu




More information about the IPython-dev mailing list