branch: elpa/with-simulated-input
commit 5f0bc054b5ba6f79affc4338847b7ea61c75d438
Author: Nikita Bloshchanevich <[email protected]>
Commit: Nikita Bloshchanevich <[email protected]>
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)