[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2e1ab3e 1/3: Bring back elisp-eldoc-documentation-function, marke
From: |
João Távora |
Subject: |
master 2e1ab3e 1/3: Bring back elisp-eldoc-documentation-function, marked obsolete |
Date: |
Fri, 30 Oct 2020 18:33:18 -0400 (EDT) |
branch: master
commit 2e1ab3e583d911afc7e263922f0672d0299bd515
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Bring back elisp-eldoc-documentation-function, marked obsolete
Fixes: bug#43609
It's not useful for ElDoc's eldoc-mode mechanism in Elisp, and nothing
in Emacs uses it, but it wasn't strictly marked internal, so it's best
to bring it back.
* lisp/progmodes/elisp-mode.el (elisp--documentation-one-liner):
New helper.
(elisp-eldoc-documentation-function): New function, with
obsoletion warning.
---
lisp/progmodes/elisp-mode.el | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index c7ff351..ce2b924 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1413,6 +1413,30 @@ which see."
or argument string for functions.
2 - `function' if function args, `variable' if variable documentation.")
+(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)))))
+ (or (progn (elisp-eldoc-var-docstring callback) str)
+ (progn (elisp-eldoc-funcall callback) str))))
+
+(defalias 'elisp-eldoc-documentation-function 'elisp--documentation-one-liner
+ "Return Elisp documentation for the thing at point as one-line string.
+This is meant as a backward compatibility aide to the \"old\"
+Elisp eldoc behaviour. Consider variable docstrings and function
+signatures only, in this order. If none applies, returns nil.
+Changes to `eldoc-documentation-functions' and
+`eldoc-documentation-strategy' are _not_ reflected here. As such
+it is preferrable to use ElDoc's interfaces directly.")
+
+(make-obsolete 'elisp-eldoc-documentation-function
+ "use ElDoc's interfaces instead." "28.1")
+
(defun elisp-eldoc-funcall (callback &rest _ignored)
"Document function call at point.
Intended for `eldoc-documentation-functions' (which see)."