diff options
| author | Lars Ingebrigtsen | 2021-01-12 15:12:28 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-01-12 15:12:38 +0100 |
| commit | ca024b0575c4ea754c4c6e6dbf21ed610e0d1fb8 (patch) | |
| tree | 4b87356a3d9a269d88a7d0a05b04afcba9b7074d /test/src | |
| parent | d191f1589b6d06221a58c8c4e6a6441b0a2a2e49 (diff) | |
| download | emacs-ca024b0575c4ea754c4c6e6dbf21ed610e0d1fb8.tar.gz emacs-ca024b0575c4ea754c4c6e6dbf21ed610e0d1fb8.zip | |
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')
| -rw-r--r-- | test/src/lread-tests.el | 6 | ||||
| -rw-r--r-- | test/src/minibuf-tests.el | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index edf88214f97..f2a60bcf327 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -190,4 +190,10 @@ literals (Bug#20852)." | |||
| 190 | (ert-deftest lread-circular-hash () | 190 | (ert-deftest lread-circular-hash () |
| 191 | (should-error (read "#s(hash-table data #0=(#0# . #0#))"))) | 191 | (should-error (read "#s(hash-table data #0=(#0# . #0#))"))) |
| 192 | 192 | ||
| 193 | (ert-deftest test-inhibit-interaction () | ||
| 194 | (let ((inhibit-interaction t)) | ||
| 195 | (should-error (read-char "foo: ")) | ||
| 196 | (should-error (read-event "foo: ")) | ||
| 197 | (should-error (read-char-exclusive "foo: ")))) | ||
| 198 | |||
| 193 | ;;; lread-tests.el ends here | 199 | ;;; lread-tests.el ends here |
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 @@ | |||
| 410 | (should (equal (try-completion "baz" '("bAz" "baz")) | 410 | (should (equal (try-completion "baz" '("bAz" "baz")) |
| 411 | (try-completion "baz" '("baz" "bAz")))))) | 411 | (try-completion "baz" '("baz" "bAz")))))) |
| 412 | 412 | ||
| 413 | (ert-deftest test-inhibit-interaction () | ||
| 414 | (let ((inhibit-interaction t)) | ||
| 415 | (should-error (read-from-minibuffer "foo: ")) | ||
| 416 | |||
| 417 | (should-error (y-or-n-p "foo: ")) | ||
| 418 | (should-error (yes-or-no-p "foo: ")) | ||
| 419 | (should-error (read-blanks-no-input "foo: ")) | ||
| 420 | |||
| 421 | ;; See that we get the expected error. | ||
| 422 | (should (eq (condition-case nil | ||
| 423 | (read-from-minibuffer "foo: ") | ||
| 424 | (inhibited-interaction 'inhibit) | ||
| 425 | (error nil)) | ||
| 426 | 'inhibit)))) | ||
| 427 | |||
| 413 | 428 | ||
| 414 | ;;; minibuf-tests.el ends here | 429 | ;;; minibuf-tests.el ends here |