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: Re: [PATCH] switch to file buffer from command line args regardless of `initial-buffer-choice' Date: Fri, 7 Aug 2015 10:42:47 -0700 Message-ID: References: <1425283676.2563.0@mail.samertm.com> <87fv7ge61j.fsf@f-box.i-did-not-set--mail-host-address--so-tickle-me> <87lhdsmndf.fsf@gmx.us> <874mkdjwt8.fsf@gmx.us> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b33984b1f4e37051cbc2b55 X-Trace: ger.gmane.org 1438969406 26797 80.91.229.3 (7 Aug 2015 17:43:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Aug 2015 17:43:26 +0000 (UTC) Cc: Rasmus , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 07 19:43:25 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 1ZNlfw-0000Ya-QB for ged-emacs-devel@m.gmane.org; Fri, 07 Aug 2015 19:43:25 +0200 Original-Received: from localhost ([::1]:50365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNlfw-00041D-8u for ged-emacs-devel@m.gmane.org; Fri, 07 Aug 2015 13:43:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNlfg-000413-ME for emacs-devel@gnu.org; Fri, 07 Aug 2015 13:43:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNlff-0002Lr-FU for emacs-devel@gnu.org; Fri, 07 Aug 2015 13:43:08 -0400 Original-Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:35802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNlff-0002LU-50 for emacs-devel@gnu.org; Fri, 07 Aug 2015 13:43:07 -0400 Original-Received: by pabxd6 with SMTP id xd6so74465851pab.2 for ; Fri, 07 Aug 2015 10:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=WMxBRZg1n5xF1bmCbfaCWcHMOvrt4ghGD4iGSPIgShM=; b=UqqMg4RYcH/ShFTaSQzfctIykH7/4cm0YP4tvvCJK8bTmoKzlV5xscYEZjwbwSQN7F z2THa8IyljgLBnnHPMOYTfhQIS5DmaNUdJm/QBwgRDDOzC+0D6THqx9jtYT+hc8C1Kwx 98kSU/OYF4cPafdoroR6IXsdtaxbAQ7yE6VUXenoueoCzl329XTNkgXn5AlfrzCsVydk SL1ANAx4/BUHaGmCfcA4Qf3gf4/mPuk0Rk2NBzg6HH2P0fDVPYMABu21daLy/Ell0wiX tgvVFa296kSdjvJ6SIAUTR1tq5Yytatm5x5inIaQYgMOZuI7jk7e3f6c5GQp2mKlgxsa m5cw== X-Received: by 10.68.218.234 with SMTP id pj10mr16804486pbc.120.1438969386452; Fri, 07 Aug 2015 10:43:06 -0700 (PDT) Original-Received: by 10.70.133.202 with HTTP; Fri, 7 Aug 2015 10:42:47 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::235 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:188577 Archived-At: --047d7b33984b1f4e37051cbc2b55 Content-Type: text/plain; charset=UTF-8 *where files were opened and displayed as soon as they were seen on the command line. On Fri, Aug 7, 2015 at 10:42 AM, Samer Masterson wrote: > The problem is that, for invocations like > > emacs --no-init-file --batch --file /tmp/foo --eval="(message \"%s\n\" > (buffer-file-name))" > > the evaled statements prints "nil" instead of "/tmp/foo" because file > buffer display was delayed until the end of the command line parsing in my > previous patch. The patch above should return Emacs to its old behavior > where files were opened as soon as they were seen on the command line. > > Is there a way of making the file buffer the current buffer without > displaying it, though? That would be ideal, because there would be less > overlap with the display logic at the bottom of the function that > determines which buffers should be displayed, and in what order. With the > patch above, if only a single file is given then it is first displayed with > `find-file', and then it is displayed again because it was added to > `displayable-buffers'. This is redundant, but probably not harmful. > > -s > > On Fri, Aug 7, 2015 at 8:33 AM, Stefan Monnier > wrote: > >> > - (buf (find-file-noselect file))) >> > + ;; Call `find-file' instead of >> `find-file-noselect' >> > + ;; so that the file buffer can be used with >> "--eval". >> > + (buf (find-file file))) >> >> Using find-file means the buffer is not only selected as current-buffer >> but is also *displayed* in the selected window (which can have all kinds >> of undesirable side-effects). >> >> Why do you think it's better? I can't seem to find the description of >> the problem this is trying to solve. >> >> >> Stefan >> > > --047d7b33984b1f4e37051cbc2b55 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
*where files were opened and displayed as soon as they wer= e seen on the command line.

On Fri, Aug 7, 2015 at 10:42 AM, Samer Masterson <nos= efrog@gmail.com> wrote:
The problem is that, for invocations like

=C2=A0 emacs --no-init-file --batch --file /tmp/foo --e= val=3D"(message \"%s\n\" (buffer-file-name))"

the evaled statements prints "nil" instead of "/t= mp/foo" because file buffer display was delayed until the end of the c= ommand line parsing in my previous patch. The patch above should return Ema= cs to its old behavior where files were opened as soon as they were seen on= the command line.

Is there a way of making the file buffer th= e current buffer without displaying it, though? That would be ideal, becaus= e there would be less overlap with the display logic at the bottom of the f= unction that determines which buffers should be displayed, and in what orde= r. With the patch above, if only a single file is given then it is first di= splayed with `find-file', and then it is displayed again because it was= added to `displayable-buffers'. This is redundant, but probably not ha= rmful.

=
-s

On Fri, Aug 7, 2015 at 8:33 AM, Stefa= n Monnier <monnier@iro.umontreal.ca> wrote:
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(buf (find-file-noselect file)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Call `find-file' instead of `find-file-n= oselect'
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0;; so that the file buffer can be used with &qu= ot;--eval".
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0(buf (find-file file)))

Using find-file means the buffer is not only selected as current-buf= fer
but is also *displayed* in the selected window (which can have all kinds of undesirable side-effects).

Why do you think it's better?=C2=A0 I can't seem to find the descri= ption of
the problem this is trying to solve.


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan


--047d7b33984b1f4e37051cbc2b55--