Subject: Re: bug#25547: 25.1.91; emacsclient -c creates frames on the wrong display

From: Eliza Velasquez <[email-masked]>
Date: Fri, 6 Nov 2020 11:14:42 -0800

To answer your second question first, if we try to use
server-create-tty-frame, Emacs will try to run display the frame in
the terminal of the calling client, which it can't do in the case of a
dumb terminal. The next best thing would be to allocate a new frame on
an existing frame's terminal, whether that is on the tty or window
system. Currently a dumb terminal running `emacsclient -c` can only
create new frames on the window system, and this patch should allow it
to create new frames on an existing tty terminal as well (once it's
working correctly). As the initial report suggests, most of the time a
dumb terminal is running `emacsclient -c`, its because it was called
as part of a script in an Emacs subprocess.

Also, I'll rename the function to something like
(server-create-frame-on-selected-terminal) since I agree its purpose
is not clear from the name.

On Thu, Nov 5, 2020 at 9:39 PM Eli Zaretskii <[email-masked]> wrote:
>
> > Cc: [email-masked], Alex Hutcheson <[email-masked]>
> > Date: Thu, 5 Nov 2020 15:41:08 -0800
> > From: Eliza Velasquez via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <[email-masked]>
> >
> > +(defun server-create-frame (nowait proc &optional parameters)
>
> This function's name is too general, and therefore will confuse
> someone who tries to learn how server.el works.  Please name it
> according to the convention used by 2 other functions in server.el
> that create GUI and TTY frames.
>
> Btw, why can't you use server-create-tty-frame here?  IOW, I don't
> think I understand this comment:
>
> > +                   ((equal tty-type "dumb")
> > +                    ;; Dumb terminals should create frames without
> > +                    ;; preference for tty or window system (bug#25547)
> > +                    (server-create-frame nowait proc frame-parameters))
>
> Thanks.