branch: externals/sly
commit 070b1dbc60d399abb9100f73f00a077ce63b07cf
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>

    Close #303: Protect sly-eval against callers that set inhibit-quit to t
    
    * sly.el (sly-eval): Set inhibit-quit to t.
---
 sly.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sly.el b/sly.el
index 741c6d9..f6be037 100644
--- a/sly.el
+++ b/sly.el
@@ -2400,8 +2400,17 @@ wants to input, and return CANCEL-ON-INPUT-RETVAL."
                      (throw catch-tag
                             (list #'error "Synchronous Lisp Evaluation 
aborted")))))
                 (cond (cancel-on-input
-                       (while (sit-for 30))
-                       (setq cancelled t)
+                       ;; Setting `inhibit-quit' to t helps with
+                       ;; callers that wrap us in `while-no-input',
+                       ;; like `fido-mode' and Helm.  It doesn't seem
+                       ;; to create any specific problems, since
+                       ;; `sit-for' exits immediately given input
+                       ;; anyway.  This include the C-g input, and
+                       ;; thus even with `inhibit-quit' set to t, quit
+                       ;; happens immediately.
+                       (unwind-protect
+                           (let ((inhibit-quit t)) (while (sit-for 30)))
+                         (setq cancelled t))
                        (funcall check-conn))
                       (t
                        (while t

Reply via email to