When `initial-buffer-choice' is set and emacs is called with a file as a command line argument, the file is opened as a background buffer and `initial-buffer-choice' is the initial buffer. This reduces the utility of calling emacs from the command line when `initial-buffer-choice' is set, and is inconsistent with the behavior of the startup screen, which is not displayed when emacs is given a file as a command line argument. This patch always opens `initial-buffer-choice', but displays the file buffer if emacs is given a file as a command line argument. Best, Samer Patch below: diff --git a/etc/NEWS b/etc/NEWS index d5cb947..f0a0541 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -63,6 +63,9 @@ so if you want to use it, you can always take a copy from an older Emacs. * Startup Changes in Emacs 25.1 +** If Emacs is given a file as a command line argument, `initial-buffer-choice' +is opened but not switched to. + * Changes in Emacs 25.1 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b9681d3..9df8e84 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-02-27 Samer Masterson + + * startup.el (command-line-1): If Emacs is given a file as a + command line argument, open initial-buffer-choice but do not + switch to it. + 2015-02-27 Mark Laws Support daemon mode on MS-Windows (bug#19688) diff --git a/lisp/startup.el b/lisp/startup.el index 999e53e..34a03ec 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2389,9 +2389,10 @@ A fancy display is used on graphic displays, normal otherwise." (find-file-noselect initial-buffer-choice)) ((functionp initial-buffer-choice) (funcall initial-buffer-choice))))) - (switch-to-buffer - (if (buffer-live-p buf) buf (get-buffer-create "*scratch*")) - 'norecord))) + (unless (> file-count 0) + (switch-to-buffer + (if (buffer-live-p buf) buf (get-buffer-create "*scratch*")) + 'norecord)))) (if (or inhibit-startup-screen initial-buffer-choice