From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Josh Newsgroups: gmane.emacs.bugs Subject: bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases Date: Thu, 3 Apr 2014 09:40:30 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0122a3d4ee87af04f626105c X-Trace: ger.gmane.org 1396543351 11681 80.91.229.3 (3 Apr 2014 16:42:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Apr 2014 16:42:31 +0000 (UTC) To: 17180@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 03 18:42:24 2014 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 1WVkie-000295-1Y for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Apr 2014 18:42:24 +0200 Original-Received: from localhost ([::1]:45032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVkid-0007qg-M7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Apr 2014 12:42:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVkiS-0007qO-5E for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:42:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVkiJ-0002Pv-3e for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:42:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVkiJ-0002Pr-0L for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WVkiI-00069l-6i for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Josh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Apr 2014 16:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17180 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.139654328923613 (code B ref -1); Thu, 03 Apr 2014 16:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Apr 2014 16:41:29 +0000 Original-Received: from localhost ([127.0.0.1]:34662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WVkhj-00068i-BJ for submit@debbugs.gnu.org; Thu, 03 Apr 2014 12:41:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42936) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WVkhe-00068Y-R1 for submit@debbugs.gnu.org; Thu, 03 Apr 2014 12:41:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVkhV-0002H4-Mq for submit@debbugs.gnu.org; Thu, 03 Apr 2014 12:41:22 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:50362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVkhV-0002H0-KE for submit@debbugs.gnu.org; Thu, 03 Apr 2014 12:41:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVkhP-0007bB-Ct for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:41:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVkhJ-0002Es-6M for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:41:07 -0400 Original-Received: from mail-yh0-f49.google.com ([209.85.213.49]:49368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVkhJ-0002EO-1D for bug-gnu-emacs@gnu.org; Thu, 03 Apr 2014 12:41:01 -0400 Original-Received: by mail-yh0-f49.google.com with SMTP id z6so1935671yhz.8 for ; Thu, 03 Apr 2014 09:41:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:content-type; bh=ix8K+91I5E6bp/ESn79ouasw07RU/HwG7w7iyg9YMng=; b=Blc0rVcluloIUzgZ5/ccR2G3okckTXVoDxTEusRT6Wfs6YphlRGx7+pdgdiJJQaKoj 6XZdkNbHillTP4qBuPWA+ZtUL1XIJ3ZFNl5W0spnaKF89FXl9C6UlPn/ec/L4qBbm0ZC Cjxf7xkDIu7LZEAlvPx4+R4VZd1uY7ERUIUc5j3W5qKmVx9qowZmXIgovfgE7AOFYSrW tL9pEqpEep8qLvYu5I8Z+bGP1xEdogXWEdmvcsypNuSZ/SDJk+VIVbmPOa59J4LSiCGm GBhxukauB7k351GkhMHClEqY//ZS4F06H7lJuVJ3ebHymHXr38m0TBEXvoKM1OT9EJ3R +kTg== X-Gm-Message-State: ALoCoQmo8YDIv94hF46uAx0xM2/6M1iky7+M+dZIpOlGl2hJE+fG5W8Y1aRsR+LJA2NOei2Hwcv7 X-Received: by 10.236.15.102 with SMTP id e66mr9640821yhe.69.1396543260090; Thu, 03 Apr 2014 09:41:00 -0700 (PDT) Original-Received: by 10.170.138.198 with HTTP; Thu, 3 Apr 2014 09:40:30 -0700 (PDT) X-Google-Sender-Auth: sVgm-wNXOR_qAI69RigyhYZU5ck X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:87713 Archived-At: --089e0122a3d4ee87af04f626105c Content-Type: text/plain; charset=ISO-8859-1 I noticed that eldoc doesn't currently show docstrings for variable aliases such as `inhibit-splash-screen'. The attached patch against the eldoc.el in trunk fixes the behavior and also cleans up the surrounding code a bit. If the latter is objectionable, the only functional change is passing `sym' through `indirect-variable' on the way to `documentation-property' as `describe-variable' does. Incidentally, I wondered whether this would be better addressed within `documentation-property' itself but I wasn't sure it would be correct to preclude the possibility of unique docstrings between aliases and their targets. === modified file 'lisp/emacs-lisp/eldoc.el' --- lisp/emacs-lisp/eldoc.el 2014-03-31 01:31:17 +0000 +++ lisp/emacs-lisp/eldoc.el 2014-04-03 16:14:43 +0000 @@ -418,18 +418,19 @@ ;; Return a string containing a brief (one-line) documentation string for ;; the variable. (defun eldoc-get-var-docstring (sym) - (when sym - (cond ((and (eq sym (aref eldoc-last-data 0)) - (eq 'variable (aref eldoc-last-data 2))) - (aref eldoc-last-data 1)) - (t - (let ((doc (documentation-property sym 'variable-documentation t))) - (cond (doc - (setq doc (eldoc-docstring-format-sym-doc - sym (eldoc-docstring-first-line doc) - 'font-lock-variable-name-face)) - (eldoc-last-data-store sym doc 'variable))) - doc))))) + (if (and (eq sym (aref eldoc-last-data 0)) + (eq 'variable (aref eldoc-last-data 2))) + (aref eldoc-last-data 1) + (let ((doc + (documentation-property (indirect-variable sym) + 'variable-documentation t))) + (when doc + (setq doc + (eldoc-docstring-format-sym-doc sym + (eldoc-docstring-first-line doc) + 'font-lock-variable-name-face)) + (eldoc-last-data-store sym doc 'variable)) + doc))) (defun eldoc-last-data-store (symbol doc type) (aset eldoc-last-data 0 symbol) --089e0122a3d4ee87af04f626105c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I noticed that eldoc doesn't currently show docstrings= for variable
aliases such as `inhibit-splash-screen'.=A0 The attach= ed patch against
the eldoc.el in trunk fixes the behavior and also clean= s up the
surrounding code a bit.=A0 If the latter is objectionable, the only
func= tional change is passing `sym' through `indirect-variable' on theway to `documentation-property' as `describe-variable' does.

Incidentally, I wondered whether this would be better addressed
with= in `documentation-property' itself but I wasn't sure it would becorrect to preclude the possibility of unique docstrings between
aliase= s and their targets.

=3D=3D=3D modified file 'lisp/emacs-lisp/eldoc.el'
--- lisp/= emacs-lisp/eldoc.el=A0=A0=A0 2014-03-31 01:31:17 +0000
+++ lisp/emacs-li= sp/eldoc.el=A0=A0=A0 2014-04-03 16:14:43 +0000
@@ -418,18 +418,19 @@
= =A0;; Return a string containing a brief (one-line) documentation string fo= r
=A0;; the variable.
=A0(defun eldoc-get-var-docstring (sym)
-=A0 (whe= n sym
-=A0=A0=A0 (cond ((and (eq sym (aref eldoc-last-data 0))
-=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (eq 'variable (aref eldoc-last-= data 2)))
-=A0=A0=A0=A0=A0=A0=A0=A0=A0 (aref eldoc-last-data 1))
-=A0=A0=A0=A0=A0=A0=A0=A0 (t
-=A0=A0=A0=A0=A0=A0=A0=A0=A0 (let ((doc (do= cumentation-property sym 'variable-documentation t)))
-=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 (cond (doc
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (setq doc (eldoc-docstring-format-sym-doc
-=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 sym (eldoc-docstring-first-line doc)
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 'font-lock-variable-name-face))
-=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (eldoc-last-data-store sym doc 'va= riable)))
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 doc)))))
+=A0 (if (and (= eq sym (aref eldoc-last-data 0))
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (eq = 9;variable (aref eldoc-last-data 2)))
+=A0=A0=A0=A0=A0 (aref eldoc-last-data 1)
+=A0=A0=A0 (let ((doc
+=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (documentation-property (indirect-variable sym)=
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 'variable-documentation t)))
+=A0= =A0=A0=A0=A0 (when doc
+=A0=A0=A0=A0=A0=A0=A0 (setq doc
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (eldoc-docstring-format-sym-doc sy= m
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (eldoc-d= ocstring-first-line doc)
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 'font-lock-variable-name-face))
+=A0=A0=A0=A0=A0=A0=A0 (eldoc-last-data-store sym doc 'variable))
+= =A0=A0=A0=A0=A0 doc)))

=A0(defun eldoc-last-data-store (symbol doc t= ype)
=A0=A0 (aset eldoc-last-data 0 symbol)



--089e0122a3d4ee87af04f626105c--