From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#12686: PATCH: ambiguous help doc strings Date: Tue, 23 Oct 2012 09:15:05 -0700 Message-ID: References: <87wqyh7i20.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1351008996 19783 80.91.229.3 (23 Oct 2012 16:16:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Oct 2012 16:16:36 +0000 (UTC) Cc: 12686@debbugs.gnu.org, "'Aaron S. Hawley'" To: "'Stefan Monnier'" , "'Juri Linkov'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 23 18:16:44 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1TQh9n-0004fS-DB for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Oct 2012 18:16:43 +0200 Original-Received: from localhost ([::1]:56997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQh9f-0008Kc-RA for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Oct 2012 12:16:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQh9N-0008Hy-6i for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 12:16:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQh9F-0007Kw-UU for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 12:16:16 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQh9F-0007Ks-QE for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 12:16:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TQhB4-000473-98 for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 12:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Oct 2012 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12686 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12686-submit@debbugs.gnu.org id=B12686.135100903315744 (code B ref 12686); Tue, 23 Oct 2012 16:18:02 +0000 Original-Received: (at 12686) by debbugs.gnu.org; 23 Oct 2012 16:17:13 +0000 Original-Received: from localhost ([127.0.0.1]:58013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TQhAG-00045t-Nw for submit@debbugs.gnu.org; Tue, 23 Oct 2012 12:17:13 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:18844) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TQhAE-00045c-B8 for 12686@debbugs.gnu.org; Tue, 23 Oct 2012 12:17:11 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q9NGFAxe014247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Oct 2012 16:15:11 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q9NGF9lr021942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Oct 2012 16:15:09 GMT Original-Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q9NGF8Yh014417; Tue, 23 Oct 2012 11:15:08 -0500 Original-Received: from dradamslap1 (/10.159.223.184) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Oct 2012 09:15:08 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac2xGpy1ZXOgJerRQiqNVDPGVHVLNAAFzvbQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65924 Archived-At: > BTW, a common cause of ambiguity is minor modes which use the same > symbol as a function and as a variable. But in most such > cases, I think the fix is not to fix the ambiguity but to make > describe-function/variable aware of minor-modes and display them in > a unified way (i.e. display a single *Help* buffer that shows the var > and the fun as a single entity, e.g. giving the args but also the link > to customize). +1, but not necessarily in the describe-function/variable code. It should be enough to do it once, in `help-make-xrefs'. And this is already done, to some extent. `help-make-xrefs' already DTRT, **IF** the symbol name is not preceded by a keyword such as `function' or `variable', i.e., if the match against `help-xref-symbol-regexp' does not match `match-string' 1 through 7, and the symbol is both a var and a fn with doc. In that case, we use button type `help-symbol', which DTRT: it shows the help for both the function and the variable. For example, if `icicle-mode' appears in the help text without any intro word such as `function', `variable', or `option', then when you click it you get the help for both the mode function `icicle-mode' and the mode variable (option) `icicle-mode'. `help-make-xrefs' could be tweaked to improve the accuracy in the case of a mode fn/var (or any other symbol that is both a fn and a var): Just change the `cond' order clauses, moving this clause before the other clauses: ((and (or (boundp sym) (get sym 'variable-documentation)) (fboundp sym)) ;; We can't intuit whether to use the ;; variable or function doc -- supply both. (help-xref-button 8 'help-symbol sym)) I.e., instead of providing such all-of-the-above behavior only as a fallback, provide it anytime we know that a given symbol is both a fn and a var (by using button type `help-symbol').