From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Better help support for EIEIO classes and methods Date: Sun, 03 Feb 2013 16:42:50 +0100 Message-ID: <877gmpz9mt.fsf@engster.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1359906176 3420 80.91.229.3 (3 Feb 2013 15:42:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Feb 2013 15:42:56 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 03 16:43:17 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U21iu-0002eM-DG for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2013 16:43:16 +0100 Original-Received: from localhost ([::1]:48185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U21ic-0002Hz-1p for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2013 10:42:58 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U21iY-0002Ho-A2 for emacs-devel@gnu.org; Sun, 03 Feb 2013 10:42:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U21iX-0001Ot-1T for emacs-devel@gnu.org; Sun, 03 Feb 2013 10:42:54 -0500 Original-Received: from randomsample.de ([83.169.19.17]:55339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U21iW-0001Om-Lb for emacs-devel@gnu.org; Sun, 03 Feb 2013 10:42:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=QGGv5MhVoVifdN+hmTbXU+ggt+mqEq/NHwdVS5zmJhk=; b=B1chc7PYrQQZglZacF3Sq3KPktVVb+6ZvEa2YaC3IzpXvIQ4R/EqZ4MG89ubkjLw/5Vy8XunmIl208nM2CteWF7bXrQUuT9oq7Rx88Wwu1rkGPbKd23q6AwIvI8slTVF; Original-Received: from dslc-082-083-047-078.pools.arcor-ip.net ([82.83.47.78] helo=spaten) by randomsample.de with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1U21iV-0003hx-Bm for emacs-devel@gnu.org; Sun, 03 Feb 2013 16:42:51 +0100 User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.92 (gnu/linux) Mail-Followup-To: emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 83.169.19.17 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156807 Archived-At: 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