Subject: Re: bug#63317: 29.0.90; ediff-auto-refine is set at require-time rather than runtime

From: Eli Zaretskii <[email-masked]>
Date: Sat, 06 May 2023 09:11:23 +0300

> Date: Fri, 5 May 2023 21:15:11 +0100 (BST)
> From: Peter Oliver <[email-masked]>
> 
> If ediff is loaded from a GUI, ediff-auto-refine defaults to "on", which is the desired behaviour.
> 
> However, if your ~/.emacs contains "(require 'ediff)", and you start emacs with the --daemon option, variable ediff-auto-refine will instead default to "nix", even if you later try to use ediff from a GUI started with "emacsclient --create-frame".

If you want the daemon session to do something that requires a GUI
frame, you need to have the relevant customizations in
server-after-make-frame-hook, so that the customizations run when such
a frame is already created.  In this case, I suggest to have that hook
change the value of ediff-auto-refine depending on whether the created
frame is a GUI frame or a TTY frame.  (Or, if you personally never
create TTY client frames, you can set ediff-auto-refine to "on"
unconditionally in that hook.)

Or maybe do that in some appropriate Ediff hook.

We cannot do this automatically, not via the default value of the
option, because a daemon session can be used for both GUI and TTY
frames (and can have frames of both types active at the same time in
the same session).

So I don't see a bug here, just a need for more elaborate
customizations in daemon sessions.