unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Samer Masterson <nosefrog@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Rasmus <rasmus@gmx.us>, emacs-devel@gnu.org
Subject: Re: [PATCH] switch to file buffer from command line args regardless of `initial-buffer-choice'
Date: Fri, 7 Aug 2015 10:42:09 -0700	[thread overview]
Message-ID: <CAP6_t8hd9DBGW2qsiA-nChc4JCdb6pQnhw94ykc5t1+Q5UM4Lw@mail.gmail.com> (raw)
In-Reply-To: <jwv614rqfo3.fsf-monnier+emacs@gnu.org>

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

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 <monnier@iro.umontreal.ca>
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
>

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

  reply	other threads:[~2015-08-07 17:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-08-07 17:42                   ` Samer Masterson
2015-08-07 21:22                   ` Stefan Monnier
2015-08-10 18:16                     ` Samer Masterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP6_t8hd9DBGW2qsiA-nChc4JCdb6pQnhw94ykc5t1+Q5UM4Lw@mail.gmail.com \
    --to=nosefrog@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).