[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 823c49cea8 2/3: ; ert-x: Simplify `ert-with-test-buffer-selecte
From: |
Eli Zaretskii |
Subject: |
emacs-29 823c49cea8 2/3: ; ert-x: Simplify `ert-with-test-buffer-selected' |
Date: |
Sat, 24 Dec 2022 02:17:38 -0500 (EST) |
branch: emacs-29
commit 823c49cea851158bc4db5ab133ecd9bf3d0791d7
Author: Richard Hansen <rhansen@rhansen.org>
Commit: Eli Zaretskii <eliz@gnu.org>
; ert-x: Simplify `ert-with-test-buffer-selected'
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected):
Simplify using 'ert-with-test-buffer'. (Bug#60189)
---
lisp/emacs-lisp/ert-x.el | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index 49f2a1d696..5f1c5c26ac 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -115,29 +115,11 @@ of BODY, which makes it easier to use `execute-kbd-macro'
to
simulate user interaction. The window configuration is restored
before returning, even if BODY exits nonlocally. The return
value is the last form in BODY."
- (declare (debug ((":name" form) def-body))
- (indent 1))
- (let ((ret (make-symbol "ert--with-test-buffer-selected-ret")))
- `(save-window-excursion
- (let (,ret)
- (ert-with-test-buffer (:name ,name)
- (with-current-buffer-window (current-buffer)
- `(display-buffer-below-selected
- (body-function
- . ,(lambda (window)
- (select-window window t)
- ;; 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))))
+ (declare (debug ((":name" form) body)) (indent 1))
+ `(ert-with-test-buffer (:name ,name)
+ (save-window-excursion
+ (with-selected-window (display-buffer (current-buffer))
+ ,@body))))
;;;###autoload
(defun ert-kill-all-test-buffers ()