Subject: bug#32921: emacsclient obeys Xresources even when launched with -nw

From: Eli Zaretskii <[email-masked]>
Date: Thu, 19 May 2022 12:44:52 +0300

> From: Po Lu <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Thu, 19 May 2022 16:59:29 +0800
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > We may be miscommunicating.  The offending code in x-win.el is called
> > at startup, only once, and sets up default-frame-alist for all the
> > future frames, including those on displays this Emacs session did not
> > yet open and knows nothing about.  How would you define
> > default-frame-alist that is specific to those as-yet-unknown displays?
> 
> I would leave it empty.

That means we stop supporting X resources, more or less.

> > And if you are saying that the code in x-win.el should only affect the
> > display on which Emacs was started, then that would be an even more
> > seriously breaking change.  Why should we assume that the user
> > intended his/her X resources to be only honored on the (random)
> > display where Emacs shows its first frame?  The files ~/.Xresources
> > and ~/.Xdefaults are not specific to any display, AFAIU, they are
> > global for the user.  Right?
> 
> Emacs _never_ honored any other X resource that happened to be on the
> first display for every display, and I have a feeling this code was a
> mistake left over from the refactoring of `x-win.el' when multi-TTY was
> developed.

How do you mean "never"?  We have here the code in x-win.el which does
that and is very old, so "never" doesn't seem to be a good description
of the situation.  And multi-TTY support has nothing to do with
multiple X displays.  AFAIU, you suggested to take the X resources
into consideration only for the first X display on which Emacs opens
its first frame.  What does this have to do with multi-TTY?

> Emacs, like all other X programs, takes resources from several different
> sources:
> 
>   - The system's locale-specific X resources.  This is normally empty on
>     modern systems.
> 
>   - The user's personal X resource files for Emacs.  This is also mostly
>     empty on modern systems.
> 
>   - The user's X defaults that were loaded into the X server.  Only if
>     the no X resources were loaded into the X server will Emacs try to
>     load them itself from ~/.Xdefaults.
> 
>   - The environment defaults.  Also empty on modern systems.
> 
> This is why X resources are typically specific to each X server, which
> is also why Emacs keeps a different resource database for each display
> connection, and does not try to apply resources (other than
> `reverseVideo') from one display connection to another.

This is completely irrelevant.  We supported X resources in Emacs
forever, and I see no reason to unsupport them now.  We need to
discuss this under the assumption that ~/.Xresources and ~/.Xdefaults
will continue to have the same effect on Emacs as they did before, at
least optionally if not by default.  Thus, suggestions to toss that
support are non-starters from where I stand.

What about the suggestion to have specially-named frame parameters in
default-frame-alist, which are defined from X resources and only
applied to GUI frames?