By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

python-mode is missing the class browser

P: n/a
I have noticed that the python-mode for Emacs that comes with the
latest Ubuntu is missing the class browser. Moreover if works
differently from the python-mode I was used to (for instance CTRL-c-c
works as CTRL-c-! whereas CTRL-c-! is missing, etc). How can I go back
to the old python-mode
or at least how do I get back the class browser?

Michele Simionato
Aug 7 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Michele Simionato a écrit :
I have noticed that the python-mode for Emacs that comes with the
latest Ubuntu is missing the class browser. Moreover if works
differently from the python-mode I was used to (for instance CTRL-c-c
works as CTRL-c-! whereas CTRL-c-! is missing, etc). How can I go back
to the old python-mode
or at least how do I get back the class browser?
I'm not really up2date wrt/ my ubuntu station here, but I remember
having seen this somewhat different (emacs-provided IIRC) python-mode
which I didn't like. I don't quite remember what I did, but I can at
least tell you what I have actually have:

- in /usr/share/emacs/site-lisp/python-mode/python-mode.el : the 'true'
python-mode which header goes like this:
"""
;;; python-mode.el --- Major mode for editing Python programs

;; Copyright (C) 1992,1993,1994 Tim Peters

;; Author: 2003-2006 http://sf.net/projects/python-mode
;; 1995-2002 Barry A. Warsaw
;; 1992-1994 Tim Peters
;; Maintainer: py*********@python.org
;; Created: Feb 1992
;; Keywords: python languages oop

(defconst py-version "$Revision: 4.78 $"
"`python-mode' version number.")
"""

- in /usr/share/emacs/22.0.91/site-lisp/python-mode/ : the corresponding
byte-compiled python-mode.elc

- in /etc/emacs/site-start.d/ : a 50python-mode.el file that reads:
"""
;-*-emacs-lisp-*-

(autoload 'python-mode "python-mode" "Python editing mode." t)
(autoload 'py-shell "python-mode" "Interactive Python interpreter." t)
(autoload 'doctest-mode "doctest-mode" "Python doctest editing mode." t)

(setq load-path
(append
(list
(concat "/usr/share/"
(symbol-name debian-emacs-flavor)
"/site-lisp/python-mode")
(concat "/usr/share/"
(symbol-name debian-emacs-flavor)
"/site-lisp/pymacs")
)
load-path))

(setq auto-mode-alist
(append
(list
'("\\.py$" . python-mode)
'("SConstruct$" . python-mode)
'("SConscript$" . python-mode)
)
auto-mode-alist))

(setq interpreter-mode-alist
(append
(list
'("python" . python-mode)
'("python2.1" . python-mode)
'("python2.2" . python-mode)
'("python2.3" . python-mode)
'("python2.4" . python-mode)
'("python2.5" . python-mode)
)
interpreter-mode-alist))
"""

emacs-version : GNU Emacs 22.0.91.1 (i486-pc-linux-gnu, GTK+ Version
2.10.6) of 2006-12-20 on rothera, modified by Debian

ubuntu Feisty Fawn (7.04)

FWIW and talking about class-browser, there's the IMHO very excellent
emacs-code-browser too.

HTH
Aug 7 '08 #2

P: n/a
Michele Simionato <mi***************@gmail.comwrites:
I have noticed that the python-mode for Emacs that comes with the
latest Ubuntu is missing the class browser. Moreover if works
differently from the python-mode I was used to (for instance CTRL-c-c
works as CTRL-c-! whereas CTRL-c-! is missing, etc). How can I go back
to the old python-mode
or at least how do I get back the class browser?
There are two different and independently developedpython-modes. The
politically correct one that comes with emacs (IIRC python.el) that had pretty
limited functionality last time I looked, and the original but not FSF blessed
python-mode.el (http://sourceforge.net/projects/python-mode/), which should
come with install instructions. If you use ipython you might additionally
want to install ipython.el, which comes with the ipython tar ball.

cheers

'as
Aug 7 '08 #3

P: n/a
Bruno Desthuilliers wrote:
Michele Simionato a écrit :
>I have noticed that the python-mode for Emacs that comes with the
latest Ubuntu is missing the class browser. Moreover if works
differently from the python-mode I was used to (for instance CTRL-c-c
works as CTRL-c-! whereas CTRL-c-! is missing, etc). How can I go back
to the old python-mode
or at least how do I get back the class browser?

I'm not really up2date wrt/ my ubuntu station here, but I remember
having seen this somewhat different (emacs-provided IIRC) python-mode
which I didn't like. I don't quite remember what I did, but I can at
least tell you what I have actually have:
<snip/>

I've got the same, and a IM-Python-menu that contains the class-browser.

FWIW and talking about class-browser, there's the IMHO very excellent
emacs-code-browser too.
Yes, it sure is cool.

And I have no idea how I ever worked without flymake & pylint :)

Emacs just rocks...
Diez
Aug 7 '08 #4

P: n/a
On Aug 7, 5:55*pm, Alexander Schmolck <a.schmo...@gmail.comwrote:
There are two different and independently developedpython-modes. The
politically correct one that comes with emacs (IIRC python.el) that had pretty
limited functionality last time I looked, and the original but not FSF blessed
python-mode.el (http://sourceforge.net/projects/python-mode/), which should
come with install instructions. If you use ipython you might additionally
want to install ipython.el, which comes with the ipython tar ball.
I have solved by using ipython.el which was already installed. For the
sake of
future googlers using Ubuntu 8.04, emacs and ipython, it is enough if
you just add

(setq ipython-command "/usr/bin/ipython")
(require 'ipython)

to your .emacs. It is nice since I get the occasion to try ipython.el
which I am
sure I will like ;)

M. Simionato
Aug 8 '08 #5

P: n/a
On Fri, Aug 8, 2008 at 7:32 AM, Michele Simionato
<mi***************@gmail.comwrote:
On Aug 7, 5:55 pm, Alexander Schmolck <a.schmo...@gmail.comwrote:
....
>
I have solved by using ipython.el which was already installed. For the
sake of
future googlers using Ubuntu 8.04, emacs and ipython, it is enough if
you just add

(setq ipython-command "/usr/bin/ipython")
(require 'ipython)

to your .emacs. It is nice since I get the occasion to try ipython.el
which I am
sure I will like ;)
So, I'm looking at the .el, but I'm not sure. What else does
ipython.el give you than just the ipython shell?
>
M. Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Aug 8 '08 #6

P: n/a
"Adam Jenkins" <em**********@gmail.comwrites:
On Fri, Aug 8, 2008 at 7:32 AM, Michele Simionato
<mi***************@gmail.comwrote:
>On Aug 7, 5:55 pm, Alexander Schmolck <a.schmo...@gmail.comwrote:
...
>>
I have solved by using ipython.el which was already installed. For the
sake of
future googlers using Ubuntu 8.04, emacs and ipython, it is enough if
you just add

(setq ipython-command "/usr/bin/ipython")
(require 'ipython)

to your .emacs. It is nice since I get the occasion to try ipython.el
which I am
sure I will like ;)

So, I'm looking at the .el, but I'm not sure. What else does
ipython.el give you than just the ipython shell?
What else could you possibly want? :)

Seriously, ipython.el is a simple kludge whose only function is to make
python-mode work with ipython (rather than python[*]). Despite this certain
primitiveness (c.f. slime), Emacs+ipython makes quite a powerful development
environment, significantly more so than ipython alone or emacs + python. Most
importantly thre is:

1. debug. Try it: write some code that will throw an unhandled exception, and
just type ``debug``. Type ``u`` and ``d`` to go up and down the stack
frame, and see the right file and line pop up in emacs. I really find that
combined with the ability to do arbitrary things with the things I find on
the stack incredibly useful for development.

2. ? and ?? as well as ed. To get help on foo you just write ``foo?``. To get
its source code as well type ``foo??``. Finally to edit the code that
correspond's to foo's class or function definition (also works on class
instances)) type ``ed foo`` (IIIRCk the default behavior is autoexecution,
so you might want to re-alias).

3. Autocompletion with tab.

4. run (including -d and -p options). Try ``run?``

5. Matplotlib and gui stuff works interactively. (-pylab cmdline option)

6. Convenient Shell interaction (ls, !, int) and interpolation from and too
python

7. Pretty printing.

But there's plenty more stuff. The most useful in terms of added functionality
via emacs is 1, but isearch and emacs editing power make the ipython shell
output also noticably more useful (and thus things like ?, ?? and pretty
printing).

cheers,

'as
[*] Inter alia the prompt parsing stuff needs to be different and the ansi
color formatting needs to be dealt with.
Aug 8 '08 #7

P: n/a
>Alexander Schmolck wrote:
"Adam Jenkins" <em**********@gmail.comwrites:
>On Fri, Aug 8, 2008 at 7:32 AM, Michele Simionato
<mi***************@gmail.comwrote:
>>On Aug 7, 5:55 pm, Alexander Schmolck <a.schmo...@gmail.comwrote:
...
>>>
I have solved by using ipython.el which was already installed. For the
sake of
future googlers using Ubuntu 8.04, emacs and ipython, it is enough if
you just add

(setq ipython-command "/usr/bin/ipython")
(require 'ipython)

to your .emacs. It is nice since I get the occasion to try ipython.el
which I am
sure I will like ;)

So, I'm looking at the .el, but I'm not sure. What else does
ipython.el give you than just the ipython shell?

What else could you possibly want? :)

Seriously, ipython.el is a simple kludge whose only function is to make
python-mode work with ipython (rather than python[*]). Despite this
certain primitiveness (c.f. slime), Emacs+ipython makes quite a powerful
development environment, significantly more so than ipython alone or emacs
+ python. Most importantly thre is:

1. debug. Try it: write some code that will throw an unhandled exception,
and
just type ``debug``. Type ``u`` and ``d`` to go up and down the stack
frame, and see the right file and line pop up in emacs. I really find
that combined with the ability to do arbitrary things with the things I
find on the stack incredibly useful for development.

2. ? and ?? as well as ed. To get help on foo you just write ``foo?``. To
get
its source code as well type ``foo??``. Finally to edit the code that
correspond's to foo's class or function definition (also works on class
instances)) type ``ed foo`` (IIIRCk the default behavior is
autoexecution, so you might want to re-alias).

3. Autocompletion with tab.

4. run (including -d and -p options). Try ``run?``

5. Matplotlib and gui stuff works interactively. (-pylab cmdline option)

6. Convenient Shell interaction (ls, !, int) and interpolation from and
too
python

7. Pretty printing.

But there's plenty more stuff. The most useful in terms of added
functionality via emacs is 1, but isearch and emacs editing power make the
ipython shell output also noticably more useful (and thus things like ?,
?? and pretty printing).

cheers,

'as
[*] Inter alia the prompt parsing stuff needs to be different and the ansi
color formatting needs to be dealt with.
--
Unfortunately, ipython.el seems to be incompatible with use on your own scripts if they process command line options (e.g., optparse).

Aug 8 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.