unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] switch to file buffer from command line args regardless of `initial-buffer-choice'
@ 2015-03-02  8:07 Samer Masterson
  2015-03-13 22:11 ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Samer Masterson @ 2015-03-02  8:07 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]

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.
 \f
 * 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.
+
 \f
 * 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  <samer@samertm.com>
+
+	* 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  <mdl@60hz.org>
 
 	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



[-- Attachment #2: Type: text/html, Size: 3618 bytes --]

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-08-10 18:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-02  8:07 [PATCH] switch to file buffer from command line args regardless of `initial-buffer-choice' Samer Masterson
2015-03-13 22:11 ` Stefan Monnier
2015-05-01 14:17   ` Samer Masterson
2015-05-16  3:11     ` Samer Masterson
2015-05-20 18:36       ` Stefan Monnier
2015-05-28 21:34         ` Samer Masterson
2015-05-29  5:48           ` Eli Zaretskii
2015-05-29  8:02             ` Samer Masterson
2015-08-03 14:56     ` Rasmus
     [not found]       ` <CAP6_t8gsmwPj5vkBQ4eegYXYcfmVAtHb+mnrUMYPyZwDXZ8DRw@mail.gmail.com>
     [not found]         ` <CAP6_t8gDr0y_WvwO43nXOFLU5h4hC-nnpjAmC-wDe7dYcTuwyw@mail.gmail.com>
     [not found]           ` <874mkdjwt8.fsf@gmx.us>
2015-08-05 20:46             ` Samer Masterson
2015-08-07 15:33               ` Stefan Monnier
2015-08-07 17:42                 ` Samer Masterson
2015-08-07 17:42                   ` Samer Masterson
2015-08-07 21:22                   ` Stefan Monnier
2015-08-10 18:16                     ` Samer Masterson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).