all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Josh <josh@foxtail.org>
To: 17180@debbugs.gnu.org
Subject: bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases
Date: Thu, 3 Apr 2014 09:40:30 -0700	[thread overview]
Message-ID: <CANdFEAE+xFWUs=sGFDp4J0B6uALRBtGBgA8DCzdP1nicr-6OZQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]

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)

[-- Attachment #2: Type: text/html, Size: 2444 bytes --]

             reply	other threads:[~2014-04-03 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 16:40 Josh [this message]
2014-04-03 17:37 ` bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases Stefan Monnier
2019-06-26 14:27   ` Lars Ingebrigtsen
2019-06-26 14:35     ` Stefan Monnier
2019-06-26 14:37       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANdFEAE+xFWUs=sGFDp4J0B6uALRBtGBgA8DCzdP1nicr-6OZQ@mail.gmail.com' \
    --to=josh@foxtail.org \
    --cc=17180@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.