From 95f7a2835a79c1f12b5dc86230405e8040910c72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 2 Nov 2020 16:24:59 +0000 Subject: [PATCH] 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 ": nil". * lisp/progmodes/elisp-mode.el (elisp--documentation-one-liner): Check callback actually produced non-nil doc. --- lisp/progmodes/elisp-mode.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index ce2b924d514..12788eacf1b 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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)))) -- 2.39.2