Subject: 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 17:34:19 +0200

Hi Stefan, emacs devs,
* Stefan Kangas <[email-masked]> [2021-10-24; 05:46]:
> Gregor Zattler <[email-masked]> writes:
>
>> Warning (initialization): An error occurred while loading ´/home/grfz/.config/emacs/init.el´:
>>
>> Symbol's value as variable is void: server-name
>>
>> It would be helpful if `server-name' would be initialized
>> early enough to be used in init.el in order to enable
>> conditional configuration of the server, depending on it's
>> name.
>
> Doesn't this just depend on when you call `server-start'?

When emacs is started with emacs --daemon=foo (or
emacsclinet -a "" -s foo [...]) one does not use
`server-start'.

> Do you have a recipe for reproducing this?

Have

(when (equal server-name "foo") (message "My name is foo!"))

in .emacs and start emacs with   emacs --daemon=foo

Ciao,
-- 
Gregor