[IPython-user] Anyone using ipython.el?

Rohan Nicholls rohan.nicholls@googlemail....
Thu Sep 18 02:50:32 CDT 2008


Okay, python-mode seems the way to go.

The code works, and I don't have time to make python.el get up to
speed, at this time or in the near future, and anyway python-mode
works for both emacs and xemacs.

Fernando, thanks for the tip it works a treat, and the %pdb on setting
is fabulous. I am thrilled, as I have a colleague that uses wing-ide
and was showing me some pretty cool things, that I was pretty sure
ipython covered, and indeed it does.  Now to figure out breakpoint
setting.

For all those on this thread who were also having problems:

You need python-mode which is found here (Yes it is old, but still
seems to work without a hitch in emacs-snapshot on hardy-heron and in
the emacs I compiled from cvs head yesterday):

http://sourceforge.net/projects/python-mode/

This has pymacs bundled with it, but it is not necessary, and
personally I don't have it in my load path.  When you extract the
tarball there is a Pymacs-nn directory, and a python-mode-n.nn
directory.  link to this or copy it to your site-lisp directory, and
then add something like this to your .emacs,

(add-to-list (add-to-list 'load-path (expand-file-name
             "path/to/pthon-mode/directory")))

Or alternatively you can just copy the python-mode.el into your
site-lisp directory.

Of course linking ipython.el into your site-lisp directory or just
copying it there. ;-)

Comment out or remove all the code that you have for python.el
settings, as they will not work, and sometimes conflict.

And here is a paired down version of the settings I have in my init
file, it works for me, so hopefully it works for you:

(add-to-list 'load-path (concat site-lisp-dir "/python-mode"))
(require 'python-mode)

(add-hook 'python-mode-hook
          (lambda ()
            (set (make-variable-buffer-local 'beginning-of-defun-function)
                 'py-beginning-of-def-or-class)
            (setq outline-regexp "def\\|class ")
             (require 'eldoc)
             (eldoc-mode 1)
            ))
;; I think python-mode might already do this, but just to be safe
(defun activate-ansi-colors ()
 (require 'ansi-color)
 (ansi-color-for-comint-mode-on)
 (add-hook 'comint-output-filter-functions
           'ansi-color-process-output))
(add-hook 'comint-mode-hook 'activate-ansi-colors)
(add-hook 'shell-mode-hook 'activate-ansi-colors)

(setq python-python-command "ipython")
(require 'ipython)

I also highly suggest using the settings found in the comments in the
beginning of the ipython.el file.

With this setup, (actually I tweak tab to do ipython-complete or
indent in python-mode, but this is bound to alt-tab by default) you
have a very handy completion using what the ipython interpreter knows
(so if you have code that you have not sent to the interpreter it will
not show up in your completion.).  I am still looking for the
equivalent of C-c C-f in python.el which would get the docstring for
the object at point, but until then just copying the object name into
the ipython shell and adding the ? gives better info.  I will look
into this, as I am sure it is in there somewhere, but I have not
created the setting correctly for it.  And of course running M-x
py-shell gives you an inferior ipython that works almost exactly like
the terminal version.

I am sorry if this was a bit obtuse a description, but I thought that
if others on the thread were having problems, this would err on the
side of too much rather than too little information.

Hope this is helpful and thanks again to Fernando and Stefan for the
help and good opinions.

Rohan

On Mon, Sep 15, 2008 at 5:03 AM, Fernando Perez <fperez.net@gmail.com> wrote:
> Hi,
>
> first, sorry for not helping on the emacs questions.  I'm glad others
> did, which is great!  Many thanks.
>
> On Sat, Sep 13, 2008 at 6:02 AM, Rohan Nicholls
> <rohan.nicholls@googlemail.com> wrote:
>
>> Thanks for the feedback.  Actually something else that would be nice
>> is some sort of
>> wrapper for running programs, and I am not sure if ipython can do this,
>> but it would allow you to run a program such as a web server or a gui,
>> things with
>> their own event loop, and still be able to have an interactive prompt.  Pywrap
>> is an example of this sort of thing, allowing you to have a wxpython
>> program running
>> and still being able to interact with the objects in the environment,
>> which is not
>> possible if you are running the program from the commandline, through the
>> interactive prompt, without invoking the interactive prompt.
>>
>> But I get ahead of myself...
>
> Does
>
> ipython -wthread
>
> not work for you?  If so, why not?  It's designed precisely for
> that... (or -qthread, -q4thread, -gthread for the other toolkits).
>
> Cheers,
>
> f
>


More information about the IPython-user mailing list