emacs-devel
[Top][All Lists]
Advanced

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

Re: Better help support for EIEIO classes and methods


From: David Engster
Subject: Re: Better help support for EIEIO classes and methods
Date: Mon, 04 Feb 2013 19:47:55 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.92 (gnu/linux)

Stefan Monnier writes:
>> 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 on.
>
> To a large extent the first line is not that important since you can add
> the missing info in the docstring itself.  Could you give more details of
> the things that can't be overcome this way?

An example: Start up with emacs -Q and eval

(require 'semantic/db)
(require 'semantic/db-global)

Then do a describe-function on semanticdb-file-table. You'll get this:

,----
| semanticdb-file-table is a Lisp function in `db.el'.
| 
| (semanticdb-file-table &rest LOCAL-ARGS)
| 
| From OBJ, return FILENAME's associated table object.
`----

Now, this is pretty misleading since there are actually two
implementations of this function, which will become clear if you use
eieio-describe-generic, which will give you this:

,----
| semanticdb-file-table is a generic function with only primary methods.
| 
| Documentation:
| From OBJ, return FILENAME's associated table object.
| 
| Implementations:
| 
| `semanticdb-project-database' :PRIMARY (obj filename)
| From OBJ, return FILENAME's associated table object.
| 
| Defined in `db.el'
| 
| 
| `semanticdb-project-database-global' :PRIMARY (obj filename)
| From OBJ, return FILENAME's associated table object.
| 
| Defined in `db-global.el'
`----

This is already pretty good, but is still lacking an IMO crucial
feature: the filenames 'db.el' and 'db-global.el' are not
links. However, just do

(add-hook 'temp-buffer-show-hook 'eieio-help-mode-augmentation-maybee t)

and call eieio-describe-generic again, and you'll get links which will
bring you to the correct implementations.

So there are two problems here:

1) I think it should not be necessary for the user to explicitly call
eieio-describe-generic; the normal describe-function should already show
this information. As I've written, in CEDET upstream we do this through
a defadvice.

2) How can eieio-help-mode-augmentation-maybee integrated into the
current setup?

And on a more general note: is the current implementation maybe
considered too hack'ish? Instead of using symbol properties for storing
the method's locations, should this rather be supported through
load-history?

-David



reply via email to

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