[IPython-user] Finally, ipython works in emacs

Jörgen Stenarson jorgen.stenarson@bostream...
Thu Dec 20 14:41:17 CST 2007


wang frank skrev:
> I have finally made the ipython works in emacs. The solution is to 
> uninstall the pyreadline library. I do not know the reason and hopefully 
> the expert can figure it out using my previouse email which includes the 
> debug information.
>  
> I think this solution has one problem that is when I run the ipython in 
> the command shell, without pyreadline it will causes problem. Can I keey 
> the pyreadline but do not use it when I am in emacs?
>  
>  

There is a commandline flag to turn pyreadline off in ipython. But I 
don't know if it turns pyreadline off completely. I believe there is 
some import magic that always imports readline if it is available even 
if completion and such things are not enabled.

There used to be some code to deal with emacs in 
pyreadline/console/console.py but it seems to have fallen away.
I don't know if it is relevant to your problem. But you could try to add 
them in again.

These lines used to be in  around line 377 in pyreadline/console/console.py:

     if os.environ.has_key("EMACS"):
         def write_color(self, text, attr=None):
             junk = c_int(0)
             self.WriteFile(self.hout, text, len(text), byref(junk),None)
             return len(text)
         write_plain = write_color

It is activated if you set an environment variable named EMACS

Now I'm off for christmas and will return in january

/Jörgen



More information about the IPython-user mailing list