Subject: bug#70819: [PATCH] Make clone-indirect-buffer-other-window use other window

From: Richard Sent <[email-masked]>
Date: Sun, 12 May 2024 23:14:19 -0400

Previously, depending on the settings in display-buffer-alist,
clone-indirect-buffer-other-window would display the cloned buffer in
the original window, behaving identically to clone-indirect-buffer with
a non-nil display-flag. This behavior was inconsistent with other-window
commands, which always used another window.

Now, clone-indirect-buffer-other-window uses
switch-to-buffer-other-window. This means it uses the same logic as
other-window commands like find-file-other-window and info-other-window
and its behavior is more consistent.

Because there is no reason for an other-window command to take a
display-flag argument, the argument was removed.

* lisp/simple.el: (clone-indirect-buffer-other-window): Use
switch-to-buffer-other-window and remove display-flag.
---
That makes sense to me, no complaints and things work as expected given
the change you suggest. Thank you all for taking the time to look into
this!

Hopefully this patch is sent successfully and makes things just a little
bit easier.

 lisp/simple.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index deab52c4201..0ab502c9f6b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -10649,7 +10649,7 @@ Returns the newly created indirect buffer."
     buffer))

-(defun clone-indirect-buffer-other-window (newname display-flag &optional norecord)
+(defun clone-indirect-buffer-other-window (newname &optional norecord)
   "Like `clone-indirect-buffer' but display in another window."
   (interactive
    (progn
@@ -10658,8 +10658,8 @@ Returns the newly created indirect buffer."
      (list (if current-prefix-arg
 	       (read-buffer "Name of indirect buffer: " (current-buffer)))
 	   t)))
-  (let ((pop-up-windows t))
-    (clone-indirect-buffer newname display-flag norecord)))
+  (switch-to-buffer-other-window
+   (clone-indirect-buffer newname nil norecord)))
 
 
 ;;; Handling of Backspace and Delete keys.
-- 
2.41.0