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.