From 82e23b327b87c09b4c4400c3df4e54c2f29231cb Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Tue, 1 Aug 2023 17:36:37 +0200 Subject: compat-29: Add window-configuration-equal-p --- NEWS.org | 1 + compat-29.el | 4 ++++ compat-tests.el | 9 +++++++++ compat.texi | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/NEWS.org b/NEWS.org index 09bdd9a..7e41ec1 100644 --- a/NEWS.org +++ b/NEWS.org @@ -5,6 +5,7 @@ * Development - compat-29: Add function =char-uppercase-p=. +- compat-29: Add function =window-configuration-equal-p=. * Release of "Compat" Version 29.1.4.2 diff --git a/compat-29.el b/compat-29.el index fc17e0f..3db94c9 100644 --- a/compat-29.el +++ b/compat-29.el @@ -37,6 +37,10 @@ (locate-file "simple" load-path (get-load-suffixes)))) "Directory where Emacs's own *.el and *.elc Lisp files are installed.") +;;;; Defined in window.c + +(compat-defalias window-configuration-equal-p compare-window-configurations) ;; + ;;;; Defined in xdisp.c (compat-defun get-display-property (position prop &optional object properties) ;; diff --git a/compat-tests.el b/compat-tests.el index 834fe0c..02fa536 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -406,6 +406,15 @@ (should-equal (getenv A) B)) (should-not (getenv A)))) +(ert-deftest compat-window-configuration-equal-p () + (let ((wc (current-window-configuration))) + (should (window-configuration-equal-p wc wc)) + (save-window-excursion + (with-temp-buffer + (pop-to-buffer (current-buffer)) + (should-not (window-configuration-equal-p (current-window-configuration) wc)))) + (should (window-configuration-equal-p (current-window-configuration) wc)))) + (ert-deftest compat-with-window-non-dedicated () (unwind-protect (progn diff --git a/compat.texi b/compat.texi index fc1a54b..1c9e278 100644 --- a/compat.texi +++ b/compat.texi @@ -3062,6 +3062,13 @@ Like @code{when-let}, but repeat until a binding in @var{spec} is This is comparable to @code{and-let*}. @end defmac +@c copied from lispref/windows.texi +@defun window-configuration-equal-p config1 config2 +This function says whether two window configurations have the same +window layout, but ignores the values of point and the saved scrolling +positions---it can return @code{t} even if those aspects differ. +@end defun + @c based on lisp/emacs-lisp/ert-x.el @defmac ert-with-temp-file name &rest body Bind @var{name} to the name of a new temporary file and evaluate -- cgit v1.0