From 1300dd1a410a172588c529734a4fb1c8b58eaef1 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 10 Apr 2022 04:06:57 +0100 Subject: 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. --- elisp/geiser-autodoc.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'elisp/geiser-autodoc.el') 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)) -- cgit v1.2.3