Subject: bug#21505: 24.4; Buffer order

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Feb 2022 15:20:27 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: Tassilo Horn <[email-masked]>,  Eli Zaretskii <[email-masked]>,
>   [email-masked],  [email-masked]
> Date: Sun, 20 Feb 2022 13:57:03 +0100
> 
> But I'm wondering -- why is Emacs popping up a *Buffer List* window when
> you ask it to open two files?

It doesn't.  It only shows *Buffer List* when you as it to visit 3 or
more files.  This is explicitly coded in command-line-1:

    ;; Display the first two buffers in `displayable-buffers'.  If
    ;; `initial-buffer-choice' is non-nil, its buffer will be the
    ;; first buffer in `displayable-buffers'.  The first buffer will
    ;; be focused.
    (let ((displayable-buffers-len (length displayable-buffers))
          ;; `nondisplayed-buffers-p' is true if there exist buffers
          ;; in `displayable-buffers' that were not displayed to the
          ;; user.
          (nondisplayed-buffers-p nil))
      (when (> displayable-buffers-len 0)
        (switch-to-buffer (car displayable-buffers)))
      (when (> displayable-buffers-len 1)
        (switch-to-buffer-other-window (car (cdr displayable-buffers)))
        ;; Focus on the first buffer.
        (other-window -1))
      (when (> displayable-buffers-len 2)  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
        (setq nondisplayed-buffers-p t))

> I'd have thought the obvious thing to do in this situation is to
> open as many windows as there are files (if possible)?

I guess the rationale is that with too many files visited we cannot be
sure which of them the user would like to see first, and we don't want
to show them all, lest the windows become too small.

> Or open a single window displaying the first file specified
> (and then have the rest be in the next-buffer order you describe).

That'd be less useful than what we do now with 2 files, IMO.