1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix Elisp's elisp--documentation-one-liner (bug#43609)

To be backward compatible, this function must return nil when there is
a symbol at point but no documentation for it.  Before this fixed it
returned the string "<symbol-name>: nil".

* lisp/progmodes/elisp-mode.el (elisp--documentation-one-liner):
Check callback actually produced non-nil doc.
This commit is contained in:
João Távora 2020-11-02 16:24:59 +00:00
parent 4e2264b60d
commit 95f7a2835a

View file

@ -1416,12 +1416,13 @@ which see."
(defun elisp--documentation-one-liner ()
(let* (str
(callback (lambda (doc &rest plist)
(setq str
(format "%s: %s"
(propertize (prin1-to-string
(plist-get plist :thing))
'face (plist-get plist :face))
doc)))))
(when doc
(setq str
(format "%s: %s"
(propertize (prin1-to-string
(plist-get plist :thing))
'face (plist-get plist :face))
doc))))))
(or (progn (elisp-eldoc-var-docstring callback) str)
(progn (elisp-eldoc-funcall callback) str))))