emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/with-simulated-input 5f0bc054b5 069/134: Better error prop


From: ELPA Syncer
Subject: [nongnu] elpa/with-simulated-input 5f0bc054b5 069/134: Better error propagation
Date: Mon, 10 Jan 2022 23:00:06 -0500 (EST)

branch: elpa/with-simulated-input
commit 5f0bc054b5ba6f79affc4338847b7ea61c75d438
Author: Nikita Bloshchanevich <nikblos@outlook.com>
Commit: Nikita Bloshchanevich <nikblos@outlook.com>

    Better error propagation
    
    Errors in KEYS are now rethrown outside of `completing-read', in an attempt 
to
    fix part of the tests.
    
    Use `mapconcat' instead of `string-join' to support older Emacsen.
---
 with-simulated-input.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/with-simulated-input.el b/with-simulated-input.el
index 8a9724e330..21f671d57b 100644
--- a/with-simulated-input.el
+++ b/with-simulated-input.el
@@ -118,17 +118,23 @@ the body form as a function."
     (define-key overriding-terminal-local-map (kbd unbound-key)
       (lambda ()
         (interactive)
-        (unless actions
-          (throw result-sym "Reached end of simulated input while simulating 
body"))
-        (funcall (pop actions))))
+        (condition-case data
+            (progn
+              (unless actions
+                (error "Reached end of simulated input while simulating body"))
+              (funcall (pop actions)))
+          (t (throw error-sym data)))))
     (catch result-sym
-      (error
-       (catch error-sym
-         (execute-kbd-macro
-          (kbd (string-join (cons unbound-key
-                                  (cl-loop for key in keys collect
-                                           (if (stringp key) key unbound-key)))
-                            " "))))))))
+      ;; Signals are not passed trough `read-from-minibuffer'.
+      (let ((err (catch error-sym
+                   (execute-kbd-macro
+                    (kbd (mapconcat
+                          #'identity
+                          (cons unbound-key
+                                (cl-loop for key in keys collect
+                                         (if (stringp key) key unbound-key)))
+                          " "))))))
+        (signal (car err) (cdr err))))))
 
 ;;;###autoload
 (defmacro with-simulated-input (keys &rest body)



reply via email to

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