all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases
@ 2014-04-03 16:40 Josh
  2014-04-03 17:37 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Josh @ 2014-04-03 16:40 UTC (permalink / raw)
  To: 17180

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-26 14:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-03 16:40 bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases Josh
2014-04-03 17:37 ` Stefan Monnier
2019-06-26 14:27   ` Lars Ingebrigtsen
2019-06-26 14:35     ` Stefan Monnier
2019-06-26 14:37       ` Lars Ingebrigtsen

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.