From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Samer Masterson Newsgroups: gmane.emacs.devel Subject: [PATCH] switch to file buffer from command line args regardless of `initial-buffer-choice' Date: Mon, 02 Mar 2015 00:07:56 -0800 Message-ID: <1425283676.2563.0@mail.samertm.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-2Z0U6hWF5LAz3JBRsNWO" X-Trace: ger.gmane.org 1425285868 27457 80.91.229.3 (2 Mar 2015 08:44:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Mar 2015 08:44:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 02 09:44:18 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YSLxZ-0000Ag-En for ged-emacs-devel@m.gmane.org; Mon, 02 Mar 2015 09:44:17 +0100 Original-Received: from localhost ([::1]:55579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSLxY-0002AO-Hf for ged-emacs-devel@m.gmane.org; Mon, 02 Mar 2015 03:44:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSLxL-0002AH-8K for emacs-devel@gnu.org; Mon, 02 Mar 2015 03:44:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSLxG-0005DO-CK for emacs-devel@gnu.org; Mon, 02 Mar 2015 03:44:03 -0500 Original-Received: from ec2-52-0-7-12.compute-1.amazonaws.com ([52.0.7.12]:48829 helo=samertm.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSLxG-0005DK-4h for emacs-devel@gnu.org; Mon, 02 Mar 2015 03:43:58 -0500 Original-Received: from [10.20.1.233] (75-101-62-71.dsl.static.fusionbroadband.com [75.101.62.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by samertm.com (Postfix) with ESMTPSA id 14DAD42D22 for ; Mon, 2 Mar 2015 08:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samertm.com; s=mail; t=1425283678; bh=HcZjoua1T44C6JL1/DwE7Y7QoqxwMfPaQGBckcPi9O4=; h=Date:From:Subject:To:From; b=pTJ896qpcPale3mRMlayEe1A3GekOpd6IViuj4x4IR4y10UpgSqhXjxDKjf7umsJl qg7p6TMvmiFNRXVXAh4kGoy1znal/wXN30h/odkA+OecAno+xPz45F0DVm/Js6ePsZ brPO2mgo0A2aI0ZjDFe30Vd88YHGt8xXzEI38pYY= X-Mailer: geary/0.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 52.0.7.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183559 Archived-At: --=-2Z0U6hWF5LAz3JBRsNWO Content-Type: text/plain; charset=utf-8 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 --=-2Z0U6hWF5LAz3JBRsNWO Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
When `initial-buffer-choice' is set and emacs is called with a fi= le as
a command line argument, the file is opened as a background= buffer and
`initial-buffer-choice' is the initial buffer. This r= educes the
utility of calling emacs from the command line when
`initial-buffer-choice' is set, and is inconsistent with the behavi= or
of the startup screen, which is not displayed when emacs is gi= ven a
file as a command line argument.

T= his 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:<= /div>

diff --git a/etc/NEWS b/etc/NEWS
index d= 5cb947..f0a0541 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -63,6 +63,9 @@ so if you want to use it, you can always take a c= opy from an older Emacs.
 =0C
 * Startup Chan= ges in Emacs 25.1
 
+** If Emacs is given a file a= s a command line argument, `initial-buffer-choice'
+is opened but= not switched to.
+
 =0C
 * Changes= in Emacs 25.1
 
diff --git a/lisp/ChangeLog b/lis= p/ChangeLog
index b9681d3..9df8e84 100644
--- a/lisp/Ch= angeLog
+++ 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 l= ine argument, open initial-buffer-choice but do not
+ switch to it.
+
 2015-02-27  Mark Laws  <mdl@60hz.org><= /div>
 
  Support daemon mode on MS-Windows (bug#19688)
<= div>diff --git a/lisp/startup.el b/lisp/startup.el
index 999e53e.= .34a03ec 100644
--- a/lisp/startup.el
+++ b/lisp/startu= p.el
@@ -2389,9 +2389,10 @@ A fancy display is used on graphic di= splays, 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
+   &nbs= p;       (if (buffer-live-p buf) buf (get-buffer-create "*sc= ratch*"))
+           'norecord))))
 
     (if (or inhibit-startup-screen
     initial-buffer-choice

= --=-2Z0U6hWF5LAz3JBRsNWO--