summaryrefslogtreecommitdiff
path: root/elisp/geiser-autodoc.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-04-10 04:06:57 +0100
committerjao <jao@gnu.org>2022-04-10 04:06:57 +0100
commit1300dd1a410a172588c529734a4fb1c8b58eaef1 (patch)
tree9cf09331f4c8957818f0e3f539376ad1e07b756e /elisp/geiser-autodoc.el
parentdcbd8e81ac19ec808a4980ea99e7ee3f4f354c79 (diff)
downloadgeiser-1300dd1a410a172588c529734a4fb1c8b58eaef1.tar.gz
geiser-1300dd1a410a172588c529734a4fb1c8b58eaef1.tar.bz2
autodoc: make do without dependending on elpa's eldoc
Playing the trick of checking for eldoc-documentation-functions to know wheter we're at a new enough version, and (hopefully) falling back to the old implementation otherwise.
Diffstat (limited to 'elisp/geiser-autodoc.el')
-rw-r--r--elisp/geiser-autodoc.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 54669a1..674e0dd 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -193,10 +193,10 @@ when `geiser-autodoc-display-module-p' is on."
(defsubst geiser-autodoc--autodoc-at-point (callback)
(geiser-autodoc--autodoc (geiser-syntax--scan-sexps) callback))
-(defun geiser-autodoc--eldoc-function (callback)
+(defun geiser-autodoc--eldoc-function (&optional callback)
(ignore-errors
(when (not (geiser-autodoc--inhibit))
- (geiser-autodoc--autodoc-at-point callback))))
+ (geiser-autodoc--autodoc-at-point (or callback 'eldoc-message)))))
(defun geiser-autodoc-show ()
"Show the signature or value of the symbol at point in the echo area."
@@ -221,11 +221,14 @@ displayed in the minibuffer."
:lighter geiser-autodoc-mode-string
:group 'geiser-autodoc
- (if geiser-autodoc-mode
- (add-hook 'eldoc-documentation-functions
- #'geiser-autodoc--eldoc-function nil t)
- (remove-hook 'eldoc-documentation-functions
- #'geiser-autodoc--eldoc-function t))
+ (if (boundp 'eldoc-documentation-functions)
+ (if geiser-autodoc-mode
+ (add-hook 'eldoc-documentation-functions
+ #'geiser-autodoc--eldoc-function nil t)
+ (remove-hook 'eldoc-documentation-functions
+ #'geiser-autodoc--eldoc-function t))
+ (set (make-local-variable 'eldoc-documentation-function)
+ (when geiser-autodoc-mode 'geiser-autodoc--eldoc-function)))
(set (make-local-variable 'eldoc-minor-mode-string) nil)
(set (make-local-variable 'eldoc-idle-delay) geiser-autodoc-delay)
(eldoc-mode (if geiser-autodoc-mode 1 -1))