Subject: Re: bug#48493: 28.0.50; quit-window doesn't work

From: martin rudalics <[email-masked]>
Date: Wed, 9 Jun 2021 10:33:37 +0200

Thanks for the patches.  Please follow ELi's suggestions first, I'll
then comment on the manual changes.

-	(current (eq (window-buffer window) (current-buffer))))
+	(current (eq (window-buffer window) (current-buffer)))
+        (dedicated (window-dedicated-p window)))
      (set-window-buffer window buffer)
+    ;; restore the dedicated side flag
+    (when (eq dedicated 'side)
+      (set-window-dedicated-p window 'side))

Here you could use the 'dedicated-side' solution you used below in
`replace-buffer-in-windows'.

+    (or ;; first try to delete dedicated windows that are not side windows
+     (and dedicated (not (eq dedicated 'side))
+          (window--delete window 'dedicated (eq bury-or-kill 'kill)))
+     (cond
+       ((and (not prev-buffer)
+             (eq (nth 1 quit-restore) 'tab)
+             (eq (nth 3 quit-restore) buffer))
+        (tab-bar-close-tab)
+        ;; If the previously selected window is still alive, select it.
+        (when (window-live-p (nth 2 quit-restore))
+          (select-window (nth 2 quit-restore))))

What's wrong with putting the first disjunct into the conditional as in
the below?  In general, always try to avoid larger indentation changes -
they can make forensics cumbersome while bisecting.

      (cond
       ;; First try to delete dedicated windows that are not side windows
       ((and dedicated (not (eq dedicated 'side))
             (window--delete window 'dedicated (eq bury-or-kill 'kill))))
       ((and (not prev-buffer)
              (eq (nth 1 quit-restore) 'tab)
              (eq (nth 3 quit-restore) buffer))

BTW, how's your paperwork process proceeding?

martin