Subject: Re: bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file

From: Gregor Zattler <[email-masked]>
Date: Sun, 24 Oct 2021 21:42:57 +0200

Hi Gregory, emacs devs,
* Gregory Heytings <[email-masked]> [2021-10-24; 15:45]:
>> Warning (initialization): An error occurred while loading 
>> ´/home/grfz/.config/emacs/init.el´:
>>
>> Symbol's value as variable is void: server-name
>
> You should (require 'server) before referring to server-name.  None of the 
> defcustoms in server.el are autoloaded.

thanks.  Requiring server prevents this error, but `server-name'
is not set to the command line value, though:

~$ cat ~/.emacs
(require 'server)
(when (equal server-name "foo") (setq greeting "My name is foo!"))
~$ emacsclient -a "" -s foo --eval '(message greeting)'
emacsclient: Should XDG_RUNTIME_DIR='/run/user/1000' be in the environment?
emacsclient: (Be careful: XDG_RUNTIME_DIR is security-related.)
emacsclient: can't find socket; have you started the server?
emacsclient: To start the server in Emacs, type "M-x server-start".
Starting Emacs daemon.
Emacs daemon should have started, trying to connect again
*ERROR*: Symbol's value as variable is void: greeting

Ciao,
-- 
Gregor