Subject: Re: bug#48367: 28.0.50; quit-restore-window may jam

From: pillule <[email-masked]>
Date: Wed, 12 May 2021 14:10:27 +0000

martin rudalics <[email-masked]> writes:

>> Is that OK to call a cl-lib function in the second patch even 
>> if this library is not required in window.el ?
>
> No.  I only re-compiled and did not build.  Please try to avoid 
> it since
> otherwise we get a
>
> In end of data:
> ../../lisp/window.el:5039:29: Warning: the function 
> ‘cl-find-if-not’ is not
>     known to be defined.
>
> warning.

Here an alternative version using subr.el instead :

>From 5c18c2b416b8fb6ef50dee6acc863130847eec03 Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <[email-masked]>
Date: Wed, 12 May 2021 10:34:40 +0000
Subject: [PATCH] Clarifying code of quit-restore-window

Still (bug #48367)

This portion may be expressed more succinctly with an higher function.
---
 lisp/window.el | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index 24b5df3396..914467aba0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5036,14 +5036,10 @@ nil means to not handle the buffer in a particular way.  This
   (setq window (window-normalize-window window t))
   (let* ((buffer (window-buffer window))
 	 (quit-restore (window-parameter window 'quit-restore))
-	 (prev-buffer
-	  (let* ((prev-buffers (window-prev-buffers window))
-		 (prev-buffer (caar prev-buffers)))
-	    (and (or (not (eq prev-buffer buffer))
-		     (and (cdr prev-buffers)
-			  (not (eq (setq prev-buffer (cadr prev-buffers))
-				   buffer))))
-		 prev-buffer)))
+         (prev-buffer (catch 'prev-buffer
+                        (dolist (buf (window-prev-buffers window))
+                          (unless (eq (car buf) buffer)
+                            (throw 'prev-buffer (car buf))))))
 	 quad entry)
     (cond
      ((and (not prev-buffer)
-- 
2.20.1

> They are trivial and we don't need an assignment for them.  But 
> signing
> the agreement is always a good idea.

Ok, it's on its way.

Thank you for the guidance.

--