all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Better help support for EIEIO classes and methods
@ 2013-02-03 15:42 David Engster
  2013-02-04  3:28 ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: David Engster @ 2013-02-03 15:42 UTC (permalink / raw
  To: emacs-devel

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.

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
definition.

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".

-David



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-02-11  3:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-03 15:42 Better help support for EIEIO classes and methods David Engster
2013-02-04  3:28 ` Stefan Monnier
2013-02-04 18:47   ` David Engster
2013-02-04 19:53     ` Stefan Monnier
2013-02-05 21:23       ` David Engster
2013-02-06 14:45         ` Stefan Monnier
2013-02-06 16:19           ` David Engster
2013-02-06 19:16             ` Stefan Monnier
2013-02-10 15:21               ` David Engster
2013-02-11  3:57                 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.