aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--test/test-perspective.el26
2 files changed, 21 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04a85ad..fef34e3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `basic-persp-test-with-persp`: evaluate `persp-test-with-persp` macro.
+### ERT tests changed
+
+- `persp-test-with-persp`: kill other perspectives than the main perspective when cleaning up.
+
+
### ERT tests fixed
- `persp-test-with-persp`: verify that a `*scratch* (NAME)` buffer exists before killing it.
diff --git a/test/test-perspective.el b/test/test-perspective.el
index a8a847a..73b13eb 100644
--- a/test/test-perspective.el
+++ b/test/test-perspective.el
@@ -47,17 +47,23 @@ perspectives and open buffers."
`(progn
(persp-mode 1)
,@body
- ;; get rid of perspective-specific *scratch* buffers first
- (mapc (lambda (persp)
- ;; `get-buffer' should suffice here, there's no need to
- ;; also call `buffer-live-p' when a string is passed as
- ;; argument to the former, but we do it anyway ;)
- (let* ((scratch-name (format "*scratch* (%s)" persp))
- (scratch-buffer (get-buffer scratch-name)))
- (when (buffer-live-p scratch-buffer)
- (kill-buffer scratch-buffer))))
- (delete persp-initial-frame-name (persp-names)))
+ (let ((other-persps (delete persp-initial-frame-name (persp-names))))
+ ;; Kill other perspectives than the main perspective to get rid
+ ;; of buffers that are not found in the main perspective.
+ (mapc #'persp-kill other-persps)
+ ;; Then get rid of perspective-specific *scratch* buffers which
+ ;; have become part of the main perspective.
+ (mapc (lambda (persp)
+ ;; `get-buffer' should suffice here, there's no need to
+ ;; also call `buffer-live-p' when a string is passed as
+ ;; argument to the former, but we do it anyway ;)
+ (let* ((scratch-name (format "*scratch* (%s)" persp))
+ (scratch-buffer (get-buffer scratch-name)))
+ (when (buffer-live-p scratch-buffer)
+ (kill-buffer scratch-buffer))))
+ other-persps))
(persp-mode -1)
+ ;; Remove live buffers that are not temporaries.
(mapc #'kill-buffer (persp-test-buffer-list-all))))
(defmacro persp-test-with-temp-buffers (vars &rest body)