]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't let docless variables hide function signature
authorJoão Távora <joaotavora@gmail.com>
Sun, 16 Aug 2020 18:03:37 +0000 (19:03 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sun, 16 Aug 2020 18:05:05 +0000 (19:05 +0100)
In Elisp mode, ElDoc will try the variable's docstring first, then the
function signature.  If the former doesn't have one, don't hide the
latter.

* lisp/progmodes/elisp-mode.el (elisp-eldoc-var-docstring): If no
symbol docstring, don't declare any.

lisp/progmodes/elisp-mode.el

index 2f44118edb53f45f5fe0725f0b13a7dfbf30fec9..21ba42a0fe1bd66b22fadf889c43886d732d0f02 100644 (file)
@@ -1420,10 +1420,12 @@ Intended for `eldoc-documentation-functions' (which see)."
 (defun elisp-eldoc-var-docstring (callback &rest _ignored)
   "Document variable at point.
 Intended for `eldoc-documentation-functions' (which see)."
-  (let ((sym (elisp--current-symbol)))
-    (when sym (funcall callback (elisp-get-var-docstring sym)
-                       :thing sym
-                       :face 'font-lock-variable-name-face))))
+  (let* ((sym (elisp--current-symbol))
+        (docstring (and sym (elisp-get-var-docstring sym))))
+    (when docstring
+      (funcall callback docstring
+               :thing sym
+               :face 'font-lock-variable-name-face))))
 
 (defun elisp-get-fnsym-args-string (sym &optional index)
   "Return a string containing the parameter list of the function SYM.