James N. V. Cash writes: > Indeed, testing with an eldoc backend (a personally hacked-up version of > clojure's cider) that actually uses the callback, it wasn't working with > the previous approach. I've attached a patch that addresses the > previously-mentioned issues as well as this. [...] > @@ -114,11 +114,17 @@ > doc-func) > (if (eq 'empty cached-func) > (when (fboundp mode-func) > - (with-temp-buffer > - (funcall mode-func) > - (setq doc-func (and eldoc-documentation-function > - (symbol-value > 'eldoc-documentation-function))) > - (puthash lang doc-func org-eldoc-local-functions-cache)) > + (with-temp-buffer > + (funcall mode-func) > + (setq doc-func (if (boundp 'eldoc-documentation-functions) > + (let ((doc-funs eldoc-documentation-functions)) > + (lambda (callback) > + (let ((eldoc-documentation-functions > doc-funs) > + (eldoc--make-callback (lambda > (_ignored) callback))) > + (funcall eldoc-documentation-strategy)))) > + (and eldoc-documentation-function > + (symbol-value > 'eldoc-documentation-function)))) > + (puthash lang doc-func org-eldoc-local-functions-cache))
All right, so we can't get by without using eldoc--make-callback here? Relying on a symbol marked with "--" makes me uneasy, and I'd like to avoid it if possible. Does your cider test case above break if we use eldoc-print-current-symbol-info without relaying the callback? That is, this squashed into your patch: diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el index b86ad1f39..06dcd6fe2 100644 --- a/contrib/lisp/org-eldoc.el +++ b/contrib/lisp/org-eldoc.el @@ -118,10 +118,9 @@ (defun org-eldoc-get-mode-local-documentation-function (lang) (funcall mode-func) (setq doc-func (if (boundp 'eldoc-documentation-functions) (let ((doc-funs eldoc-documentation-functions)) - (lambda (callback) - (let ((eldoc-documentation-functions doc-funs) - (eldoc--make-callback (lambda (_ignored) callback))) - (funcall eldoc-documentation-strategy)))) + (lambda () + (let ((eldoc-documentation-functions doc-funs)) + (eldoc-print-current-symbol-info)))) (and eldoc-documentation-function (symbol-value 'eldoc-documentation-function)))) (puthash lang doc-func org-eldoc-local-functions-cache)) @@ -133,7 +132,7 @@ (declare-function css-eldoc-function "css-eldoc" ()) (declare-function php-eldoc-function "php-eldoc" ()) (declare-function go-eldoc--documentation-function "go-eldoc" ()) -(defun org-eldoc-documentation-function (&rest args) +(defun org-eldoc-documentation-function (&rest _ignored) "Return breadcrumbs when on a headline, args for src block header-line, calls other documentation functions depending on lang when inside src body." (or @@ -166,12 +165,9 @@ (defun org-eldoc-documentation-function (&rest args) (string= lang "go") (string= lang "golang")) (when (require 'go-eldoc nil t) (go-eldoc--documentation-function))) - (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang)) - (callback (car args))) + (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))) (when (functionp doc-fun) - (if (functionp callback) - (funcall doc-fun callback) - (funcall doc-fun))))))))) + (funcall doc-fun)))))))) ;;;###autoload (defun org-eldoc-load ()