emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/eldoc-async 114b5ae 3/5: Fix small synch bugs in in eldoc-print-


From: João Távora
Subject: scratch/eldoc-async 114b5ae 3/5: Fix small synch bugs in in eldoc-print-current-symbol-info
Date: Sun, 14 Jun 2020 09:09:13 -0400 (EDT)

branch: scratch/eldoc-async
commit 114b5aeb5da2a4e181dcf05651e7da6e7f8173c4
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix small synch bugs in in eldoc-print-current-symbol-info
    
    Ensure that eldoc-documentation-compose and
    eldoc-documentation-compose-eagerly both eventually produce the same
    effect, whatever the functions in eldoc-documentation-functions are.
    
    * lisp/emacs-lisp/eldoc.el (eldoc-documentation-compose): Call
    callback even if hook function reports nil.
    (eldoc-print-current-symbol-info): Don't mess up docs-registering
    by sorting it.  Make all callbacks return non-string non-t for
    convenience.
---
 lisp/emacs-lisp/eldoc.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index fe985e9..be78b13 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -476,7 +476,7 @@ Meant as a value for `eldoc-documentation-strategy'."
                       (let* ((callback (eldoc--make-callback
                                         (if eagerlyp :eager :patient)))
                              (str (funcall f callback)))
-                        (if (stringp str) (funcall callback str))
+                        (if (or (null str) (stringp str)) (funcall callback 
str))
                         nil)))
   t)
 
@@ -573,8 +573,9 @@ documentation themselves."
                (display-doc ()
                 (eldoc--handle-docs
                  (mapcar #'cdr
-                         (sort docs-registered
-                               (lambda (a b) (< (car a) (car b)))))))
+                         (setq docs-registered
+                               (sort docs-registered
+                                     (lambda (a b) (< (car a) (car b))))))))
                (make-callback (method)
                 (let ((pos (prog1 howmany (cl-incf howmany))))
                   (cl-ecase method
@@ -590,16 +591,19 @@ documentation themselves."
                            (cancel-timer eldoc--enthusiasm-curbing-timer))
                          (setq eldoc--enthusiasm-curbing-timer
                                (run-at-time (unless (zerop pos) 0.3)
-                                            nil #'display-doc)))))
+                                            nil #'display-doc)))
+                       t))
                     (:patient
                      (cl-incf want)
                      (lambda (string &rest plist)
                        (register-doc pos string plist)
-                       (when (zerop (cl-decf want)) (display-doc))))
+                       (when (zerop (cl-decf want)) (display-doc))
+                       t))
                     (:eager
                      (lambda (string &rest plist)
                        (register-doc pos string plist)
-                       (display-doc)))))))
+                       (display-doc)
+                       t))))))
             (let* ((eldoc--make-callback #'make-callback)
                    (res (funcall eldoc-documentation-strategy)))
               (cond (;; old protocol: got string, output immediately



reply via email to

[Prev in Thread] Current Thread [Next in Thread]