[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Better help support for EIEIO classes and methods

From: David Engster
Subject: Better help support for EIEIO classes and methods
Date: Sun, 03 Feb 2013 16:42:50 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.92 (gnu/linux)

In Emacs proper, if you use describe-function on an EIEIO class
constructor like `auth-source-backend', you will get

auth-source-backend is a Lisp function.

as the first line, which is not very helpful. If you know that this is
actually a class constructor, you can at least call eieio-describe-class
or eieio-describe-constructor, which will give you a much more detailed
description, but is still missing one essential feature: a link to the
filename where this class is defined, which quickly brings you to the
correct class definition. This is even more important for methods, which
can have several implementations depending on the class they're called

Here's how we do it in CEDET upstream: Since defclass/defmethod is not
supported by load-history, we use the symbol properties `class-location'
and `method-locations' for storing this information (see
`eieio-defclass' and `eieiomt-add'; this is also in Emacs proper).

We put defadvices on describe-function and describe-variable which
branch off to eieio-describe-class, eieio-describe-generic and
eieio-describe-constructor if we're dealing with one of those. Lastly,
we put the function eieio-help-mode-augmentation-maybee in
temp-buffer-show-hook, which puts proper hyperlinks into the help
buffer, invoking helper functions to find the proper class or method

The question is how this can be properly integrated into Emacs. The
easiest way would be to use the existing code and just do what our
defadvices do, meaning branching off early in `describe-function' if it
sees that this is a class constructor or method. The other solution
would be to fiddle all this stuff into describe-function-1,
find-lisp-object-file-name, etc., which would however lead to a lot of
code like "if this is a class/method then do this, otherwise do that".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]