Subject: bug#26995: 26.0.50; emacsclient --tty FILE flashes previous frame's buffer before loading FILE

From: Aaron Jensen <[email-masked]>
Date: Mon, 5 Feb 2018 01:56:22 -0500

From: Eli Zaretskii (mailto:[email-masked])
> > From: Aaron Jensen
> > > I can indeed reproduce the described behavior, but I see the same in
> > > Emacs 25.2 and in Emacs 24.5. The reason is simple: the way server.el
> > > is written, we first create the client frame, and only then show the
> > > file there. So the frame is created with no file to visit, and Emacs
> > > always shows the last buffer in the new frame in those cases.
> >
> > I see, so not a bug then. Is it possible to (easily) improve its behavior?
>
> It should be possible, but AFAICT it would need restructuring
> server-process-filter works.

Please see attached patch and let me know if this method is
acceptable. It’s perhaps a little kludgy because sometimes a frame is
created and sometimes it isn’t so we need both methods of ensuring the
initial frame is set properly. This does appear to work for all
scenarios I tested, however.

Thanks,

Aaron