emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2e54ffe: Don't display an initial-buffer-choice buf


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 2e54ffe: Don't display an initial-buffer-choice buffer twice
Date: Tue, 17 Apr 2018 17:56:08 -0400 (EDT)

branch: master
commit 2e54ffebb8555d23f72c7b450b481f0335562b0d
Author: David Beswick <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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
---
 lisp/startup.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index 1faeabf..f6907a8 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]