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.The problem is that, for invocations likethe 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.
emacs --no-init-file --batch --file /tmp/foo --eval="(message \"%s\n\" (buffer-file-name))"-sOn 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