]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Elisp's elisp--documentation-one-liner (bug#43609)
authorJoão Távora <joaotavora@gmail.com>
Mon, 2 Nov 2020 16:24:59 +0000 (16:24 +0000)
committerJoão Távora <joaotavora@gmail.com>
Mon, 2 Nov 2020 16:25:43 +0000 (16:25 +0000)
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.

lisp/progmodes/elisp-mode.el

index ce2b924d51497c290032e5d952cd1f188e507efd..12788eacf1bdb073e4d0669893cc54865200e33b 100644 (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))))