branch: externals/eldoc-eval
commit cc376663783ec4f7527b6ef864942a42737f0767
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Make timer not accessible within body.
    
    * eldoc-eval.el (with-eldoc-in-minibuffer): Do it.
---
 eldoc-eval.el | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/eldoc-eval.el b/eldoc-eval.el
index 09ac0d7992..eb7d5799a9 100644
--- a/eldoc-eval.el
+++ b/eldoc-eval.el
@@ -123,22 +123,23 @@ See `with-eldoc-in-minibuffer'."
 (defmacro with-eldoc-in-minibuffer (&rest body)
   "Enable eldoc support for minibuffer input that runs in BODY."
   (declare (indent 0) (debug t))
-  `(let ((timer (and eldoc-in-minibuffer-mode
-                     (run-with-idle-timer
-                      eldoc-idle-delay
-                      'repeat #'eldoc-run-in-minibuffer))))
-     (unwind-protect
-         (minibuffer-with-setup-hook
-             ;; When minibuffer is activated in body, store it.
-             #'eldoc-store-minibuffer
-           ,@body)
-       (and timer (cancel-timer timer))
-       ;; Each time a minibuffer exits or aborts
-       ;; its buffer is removed from stack,
-       ;; assuming we can only exit the active minibuffer
-       ;; on top of stack.
-       (setq eldoc-active-minibuffers-list
-             (cdr eldoc-active-minibuffers-list)))))
+  (let ((timer (make-symbol "eldoc-eval--timer")))
+    `(let ((,timer (and eldoc-in-minibuffer-mode
+                       (run-with-idle-timer
+                        eldoc-idle-delay
+                        'repeat #'eldoc-run-in-minibuffer))))
+       (unwind-protect
+            (minibuffer-with-setup-hook
+                ;; When minibuffer is activated in body, store it.
+                #'eldoc-store-minibuffer
+              ,@body)
+         (and ,timer (cancel-timer ,timer))
+         ;; Each time a minibuffer exits or aborts
+         ;; its buffer is removed from stack,
+         ;; assuming we can only exit the active minibuffer
+         ;; on top of stack.
+         (setq eldoc-active-minibuffers-list
+               (cdr eldoc-active-minibuffers-list))))))
 
 (defun eldoc-current-buffer ()
   "Return the current buffer prior to activating the minibuffer."

Reply via email to