diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-09-21 21:45:02 +0200 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-09-21 21:45:02 +0200 |
commit | 5a8be1719a80031ea3833749b1e82de8d5a39787 (patch) | |
tree | 1f3cb774fd9e222b7d4f2f426695e7894ee7b297 /lisp/emacs-lisp/ert-x.el | |
parent | 5b41545f1be367837d9ac717ea67fba19a4c24d4 (diff) | |
parent | fb68645b5a258c98acc11efdc3caae80683cc6b0 (diff) | |
download | emacs-5a8be1719a80031ea3833749b1e82de8d5a39787.tar.gz emacs-5a8be1719a80031ea3833749b1e82de8d5a39787.tar.bz2 emacs-5a8be1719a80031ea3833749b1e82de8d5a39787.zip |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lisp/emacs-lisp/ert-x.el')
-rw-r--r-- | lisp/emacs-lisp/ert-x.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 622f5654b25..6569b8ccc87 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -177,6 +177,18 @@ test for `called-interactively' in the command will fail." (cl-assert (not unread-command-events) t) return-value)) +(defmacro ert-simulate-keys (keys &rest body) + "Execute BODY with KEYS as pseudo-interactive input." + (declare (debug t) (indent 1)) + `(let ((unread-command-events + ;; Add some C-g to try and make sure we still exit + ;; in case something goes wrong. + (append ,keys '(?\C-g ?\C-g ?\C-g))) + ;; Tell `read-from-minibuffer' not to read from stdin when in + ;; batch mode. + (executing-kbd-macro t)) + ,@body)) + (defun ert-run-idle-timers () "Run all idle timers (from `timer-idle-list')." (dolist (timer (copy-sequence timer-idle-list)) |