diff options
author | Richard Hansen <rhansen@rhansen.org> | 2022-09-26 17:07:52 -0400 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-09-27 13:43:53 +0200 |
commit | 29b7d740006fe2190a729bd1c30ccab9356cee36 (patch) | |
tree | 272667e5989434987394ea5ede945d71af536f44 /lisp/emacs-lisp | |
parent | 0b1e3713fea9b7c28891ec094689f40c0dc996c4 (diff) | |
download | emacs-29b7d740006fe2190a729bd1c30ccab9356cee36.tar.gz emacs-29b7d740006fe2190a729bd1c30ccab9356cee36.tar.bz2 emacs-29b7d740006fe2190a729bd1c30ccab9356cee36.zip |
ert-x: Improve realism of `ert-with-test-buffer-selected'
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected): Set
`inhibit-read-only' and `buffer-read-only' to nil when executing the
body to provide a more realistic test environment.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/ert-x.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index f00f1b33d78..bfd796586da 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -126,7 +126,15 @@ value is the last form in BODY." (body-function . ,(lambda (window) (select-window window t) - (let ((inhibit-modification-hooks nil)) + ;; body-function is intended to initialize the + ;; contents of a temporary read-only buffer, so + ;; it is executed with some convenience + ;; changes. Undo those changes so that the + ;; test buffer behaves more like an ordinary + ;; buffer while the body executes. + (let ((inhibit-modification-hooks nil) + (inhibit-read-only nil) + (buffer-read-only nil)) (setq ,ret (progn ,@body)))))) nil)) ,ret)))) |