I'd like some way to easily determine the class that
the Emacs point is in. I looked for a way but didn't
find anything relevant.
For the moment, I've put together something that
attempts to determine the current class and display it
via the echo area. Code follows:
(defun py-show-current-class ()
(interactive)
(save-excursion
(let ((class-name nil))
(if (py-go-up-tree-to-keyword "class")
(setq class-name (py-current-defun))
(setq class-name "None determined"))
(message (format "Current class: %s" class-name)))))
P.S. I thought of working with which-function-mode, but
the mode line seems too crowded already.
Logged In: YES
user_id=1070539
I just learned about header-line-format in Emacs 21 --
perhaps the current class can be displayed there.
Logged In: YES
user_id=44345
Have you taken a look at Emacs' func-menu package? It's a start,
though I don't think it handles nested scopes. If you were to come
up with a patch for it, it would probably help beyond Python.
(Sorry for the delay responding. I didn't know about this tracker.)
Skip
Logged In: YES
user_id=1070539
I didn't know about func-menu -- are you
referring to the following?
http://media.wu-wien.ac.at/emacs/func-menu.el
FWIW, since I submitted this report, I've done a
copy-modify job [1] on which-func and created
which-class.el. Using this, the current class
name and function name are displayed in the
header line (at least for Python). I've found
that being able to determine which class and
function point is in at a glance (w/o having
to enter any command) is quite nice.
[1] Yes, a patch would have been nice but
which-func seemed very mode-line-specific...