emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 29b7d74000 1/2: ert-x: Improve realism of `ert-with-test-buffer-s


From: Lars Ingebrigtsen
Subject: master 29b7d74000 1/2: ert-x: Improve realism of `ert-with-test-buffer-selected'
Date: Tue, 27 Sep 2022 07:45:13 -0400 (EDT)

branch: master
commit 29b7d740006fe2190a729bd1c30ccab9356cee36
Author: Richard Hansen <rhansen@rhansen.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/emacs-lisp/ert-x.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index f00f1b33d7..bfd796586d 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))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]