aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/eldoc.el37
1 files changed, 21 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 1eb0d38c5ce..18d3eb37af3 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -681,29 +681,34 @@ This is the default value for `eldoc-documentation-strategy'."
681 (lambda (f) 681 (lambda (f)
682 (funcall f (eldoc--make-callback :eager f))))) 682 (funcall f (eldoc--make-callback :eager f)))))
683 683
684(defun eldoc--documentation-compose-1 (eagerlyp)
685 "Helper function for composing multiple doc strings.
686If EAGERLYP is non-nil show documentation as soon as possible,
687else wait for all doc strings."
688 (run-hook-wrapped 'eldoc-documentation-functions
689 (lambda (f)
690 (let* ((callback (eldoc--make-callback
691 (if eagerlyp :eager :patient)
692 f))
693 (str (funcall f callback)))
694 (if (or (null str) (stringp str)) (funcall callback str))
695 nil)))
696 t)
697
698(defun eldoc-documentation-compose () 684(defun eldoc-documentation-compose ()
699 "Show multiple documentation strings together after waiting for all of them. 685 "Show multiple documentation strings together after waiting for all of them.
700This is meant to be used as a value for `eldoc-documentation-strategy'." 686This is meant to be used as a value for `eldoc-documentation-strategy'."
701 (eldoc--documentation-compose-1 nil)) 687 (let (fns-and-callbacks)
688 ;; Make all the callbacks, setting up state inside
689 ;; `eldoc--invoke-strategy' to know how many callbacks to wait for
690 ;; before displaying the result (bug#62816).
691 (run-hook-wrapped 'eldoc-documentation-functions
692 (lambda (f)
693 (push (cons f (eldoc--make-callback :patient f))
694 fns-and-callbacks)
695 nil))
696 ;; Now call them. The last one will trigger the display.
697 (cl-loop for (f . callback) in fns-and-callbacks
698 for str = (funcall f callback)
699 when (or (null str) (stringp str)) do (funcall callback str)))
700 t)
702 701
703(defun eldoc-documentation-compose-eagerly () 702(defun eldoc-documentation-compose-eagerly ()
704 "Show multiple documentation strings one by one as soon as possible. 703 "Show multiple documentation strings one by one as soon as possible.
705This is meant to be used as a value for `eldoc-documentation-strategy'." 704This is meant to be used as a value for `eldoc-documentation-strategy'."
706 (eldoc--documentation-compose-1 t)) 705 (run-hook-wrapped 'eldoc-documentation-functions
706 (lambda (f)
707 (let* ((callback (eldoc--make-callback :eager f))
708 (str (funcall f callback)))
709 (if (or (null str) (stringp str)) (funcall callback str))
710 nil)))
711 t)
707 712
708(defun eldoc-documentation-enthusiast () 713(defun eldoc-documentation-enthusiast ()
709 "Show most important documentation string produced so far. 714 "Show most important documentation string produced so far.