bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases


From: Josh
Subject: bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases
Date: Thu, 3 Apr 2014 09:40:30 -0700

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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]