summaryrefslogtreecommitdiff
path: root/test/src/minibuf-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-01-12 15:12:28 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-01-12 15:12:38 +0100
commitca024b0575c4ea754c4c6e6dbf21ed610e0d1fb8 (patch)
tree4b87356a3d9a269d88a7d0a05b04afcba9b7074d /test/src/minibuf-tests.el
parentd191f1589b6d06221a58c8c4e6a6441b0a2a2e49 (diff)
downloademacs-ca024b0575c4ea754c4c6e6dbf21ed610e0d1fb8.tar.gz
Add a new variable `inhibit-interaction'
* doc/lispref/elisp.texi (Top): Add a link. * doc/lispref/errors.texi (Standard Errors): Mention the new error. * doc/lispref/minibuf.texi (Minibuffers): Add a link. (Inhibiting Interaction): New node. * src/data.c (syms_of_data): Define the `inhibited-interaction' error. * src/lisp.h: Export the barfing function. * src/lread.c (Fread_char, Fread_event, Fread_char_exclusive): Barf if inhibited. * src/minibuf.c (barf_if_interaction_inhibited): New function. (Fread_from_minibuffer, Fread_no_blanks_input): Barf if inhibited. (syms_of_minibuf): Define the `inhibit-interaction' variable.
Diffstat (limited to 'test/src/minibuf-tests.el')
-rw-r--r--test/src/minibuf-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el
index b9cd255462d..28119fc999e 100644
--- a/test/src/minibuf-tests.el
+++ b/test/src/minibuf-tests.el
@@ -410,5 +410,20 @@
(should (equal (try-completion "baz" '("bAz" "baz"))
(try-completion "baz" '("baz" "bAz"))))))
+(ert-deftest test-inhibit-interaction ()
+ (let ((inhibit-interaction t))
+ (should-error (read-from-minibuffer "foo: "))
+
+ (should-error (y-or-n-p "foo: "))
+ (should-error (yes-or-no-p "foo: "))
+ (should-error (read-blanks-no-input "foo: "))
+
+ ;; See that we get the expected error.
+ (should (eq (condition-case nil
+ (read-from-minibuffer "foo: ")
+ (inhibited-interaction 'inhibit)
+ (error nil))
+ 'inhibit))))
+
;;; minibuf-tests.el ends here