diff options
author | David Beswick <dlbeswick@gmail.com> | 2018-04-17 23:53:55 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2018-04-17 23:54:14 +0200 |
commit | 2e54ffebb8555d23f72c7b450b481f0335562b0d (patch) | |
tree | a757dd55fc5154275ec5d9c43baa18f5955e833e /lisp/startup.el | |
parent | d2d1f39536e32dc6789ee2d26aeda05a405d47d3 (diff) | |
download | emacs-2e54ffebb8555d23f72c7b450b481f0335562b0d.tar.gz |
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
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 1faeabf23b8..f6907a821b9 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -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 |