Subject: Re: bug#68255: 28.2; Can't connect to emacs daemon after logging out and back in.

From: Eli Zaretskii <[email-masked]>
Date: Sat, 06 Jan 2024 08:54:24 +0200

[Please use Reply All to reply, to keep the bug tracker CC'ed.]

> From: Jeremy Phelps <[email-masked]>
> Date: Fri, 5 Jan 2024 15:13:43 -0500
> 
> > If the above analysis is correct, then you can customize 'server-name'
> > to be an absolute file name of the directory where you want the socket
> > to be created, and invoke emacsclient with the --socket-name=NAME
> > option (or set EMACS_SOCKET_NAME=NAME in the environment), where NAME
> > is the same directory as in the value of 'server-name' option.  Did
> > you try that?
> 
> I did not try that, and I wouldn't be able to test it without reinstalling Emacs
> to get rid of my workaround.

Well, I'd encourage you to try this, because if it works, then there
is a solution to this situation, and if it doesn't work, we need to
fix whatever prevents it from working.

> But given that XDG_RUNTIME_DIR is ephemeral, and
> the Emacs daemon assumes it is not, it makes little sense to use it. It would
> make more sense to create a directory under ~/.emacs.d if security is the
> reason for using the XDG directory instead of /tmp.

I hear you, but other people disagree.  Some don't need to leave the
Emacs daemon running when they log off, and some say (AFAIU) that the
XDG directories don't get deleted when they log off.  So we support
both methods, and the XDG support takes precedence because most users
prefer it, AFAIU.