emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] switch to file buffer from command line args regardless of `


From: Samer Masterson
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

*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 <address@hidden> 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 <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]