1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

Don't display an initial-buffer-choice buffer twice

* lisp/startup.el (command-line-1): Don't display an
initial-buffer-choice buffer twice if the user is also explicitly
specifying it on the mode line, but shift it to the initial place
(bug#29999).

Copyright-paperwork-exempt: yes
This commit is contained in:
David Beswick 2018-04-17 23:53:55 +02:00 committed by Lars Ingebrigtsen
parent d2d1f39536
commit 2e54ffebb8

View File

@ -2504,7 +2504,12 @@ nil default-directory" name)
(insert (substitute-command-keys initial-scratch-message))
(set-buffer-modified-p nil))))
;; Prepend `initial-buffer-choice' to `displayable-buffers'.
;; Prepend `initial-buffer-choice' to `displayable-buffers'. If
;; the buffer is already a member of that list then shift the
;; buffer to the head of the list. The shift behavior is intended
;; to prevent the same buffer being displayed in two windows when
;; an `initial-buffer-choice' function happens to return the head
;; of `displayable-buffers'.
(when initial-buffer-choice
(let ((buf
(cond ((stringp initial-buffer-choice)
@ -2517,7 +2522,7 @@ nil default-directory" name)
(error "initial-buffer-choice must be a string, a function, or t.")))))
(unless (buffer-live-p buf)
(error "initial-buffer-choice is not a live buffer."))
(setq displayable-buffers (cons buf displayable-buffers))))
(setq displayable-buffers (cons buf (delq buf displayable-buffers)))))
;; Display the first two buffers in `displayable-buffers'. If
;; `initial-buffer-choice' is non-nil, its buffer will be the