* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
@ 2021-10-23 18:39 Gregor Zattler
2021-10-24 12:46 ` Stefan Kangas
0 siblings, 1 reply; 10+ messages in thread
From: Gregor Zattler @ 2021-10-23 18:39 UTC (permalink / raw)
To: 51360
Dear emacs developers, if emacs is started as a named daemon
like this: `emacs --damon=foo' or like this:
`emacsclient -a "" -s foo [...]' the variable `server-name'
is initialized with the name "foo" but too late to be used
in init.el:
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.
Thanks for your attention, Gregor
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-23 18:39 bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file Gregor Zattler
@ 2021-10-24 12:46 ` Stefan Kangas
2021-10-24 15:34 ` Gregor Zattler
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2021-10-24 12:46 UTC (permalink / raw)
To: Gregor Zattler; +Cc: 51360
Gregor Zattler <grfz@gmx.de> 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'?
Do you have a recipe for reproducing this?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-24 12:46 ` Stefan Kangas
@ 2021-10-24 15:34 ` Gregor Zattler
2021-10-24 15:45 ` Gregory Heytings
2021-10-24 15:59 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Gregor Zattler @ 2021-10-24 15:34 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 51360
Hi Stefan, emacs devs,
* Stefan Kangas <stefan@marxist.se> [2021-10-24; 05:46]:
> Gregor Zattler <grfz@gmx.de> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-24 15:34 ` Gregor Zattler
@ 2021-10-24 15:45 ` Gregory Heytings
2021-10-24 19:42 ` Gregor Zattler
2021-10-24 15:59 ` Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: Gregory Heytings @ 2021-10-24 15:45 UTC (permalink / raw)
To: Gregor Zattler; +Cc: 51360, Stefan Kangas
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
>
> 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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-24 15:45 ` Gregory Heytings
@ 2021-10-24 19:42 ` Gregor Zattler
0 siblings, 0 replies; 10+ messages in thread
From: Gregor Zattler @ 2021-10-24 19:42 UTC (permalink / raw)
To: 51360
Hi Gregory, emacs devs,
* Gregory Heytings <gregory@heytings.org> [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
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-24 15:34 ` Gregor Zattler
2021-10-24 15:45 ` Gregory Heytings
@ 2021-10-24 15:59 ` Eli Zaretskii
2021-10-24 20:00 ` Gregor Zattler
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2021-10-24 15:59 UTC (permalink / raw)
To: Gregor Zattler; +Cc: 51360, stefan
> From: Gregor Zattler <grfz@gmx.de>
> Date: Sun, 24 Oct 2021 17:34:19 +0200
> Cc: 51360@debbugs.gnu.org
>
> 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
Whatever you do that you need server-name for, can't you do that in
emacs-startup-hook? AFAIR, that gets called after the daemon already
finished its initialization and provided its name to Emacs, so
server-name should be already populated.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-24 15:59 ` Eli Zaretskii
@ 2021-10-24 20:00 ` Gregor Zattler
2021-10-25 2:27 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Gregor Zattler @ 2021-10-24 20:00 UTC (permalink / raw)
To: 51360
Hi Eli, emacs devs,
* Eli Zaretskii <eliz@gnu.org> [2021-10-24; 18:59]:
>> From: Gregor Zattler <grfz@gmx.de>
>> Date: Sun, 24 Oct 2021 17:34:19 +0200
>> Cc: 51360@debbugs.gnu.org
>>
>> 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
>
> Whatever you do that you need server-name for, can't you do that in
> emacs-startup-hook? AFAIR, that gets called after the daemon already
> finished its initialization and provided its name to Emacs, so
> server-name should be already populated.
the idea is to initialise the emacs daemon depending on it's
server-name. Therefore doing it via emacs-startup-hook is
somewhat counter-intuitive
But you are right that works. Thanks.
Ciao,
--
Gregor
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-24 20:00 ` Gregor Zattler
@ 2021-10-25 2:27 ` Eli Zaretskii
2021-10-25 8:02 ` Gregor Zattler
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2021-10-25 2:27 UTC (permalink / raw)
To: Gregor Zattler; +Cc: 51360
> From: Gregor Zattler <grfz@gmx.de>
> Date: Sun, 24 Oct 2021 22:00:21 +0200
>
> > Whatever you do that you need server-name for, can't you do that in
> > emacs-startup-hook? AFAIR, that gets called after the daemon already
> > finished its initialization and provided its name to Emacs, so
> > server-name should be already populated.
>
> the idea is to initialise the emacs daemon depending on it's
> server-name. Therefore doing it via emacs-startup-hook is
> somewhat counter-intuitive
Sorry, I don't think I follow: what has intuition got to do with this?
And what do you mean by "initialise the emacs daemon"? -- that happens
out of your control, in the internal Emacs code.
> But you are right that works. Thanks.
So does this mean your problem is solved?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file
2021-10-25 2:27 ` Eli Zaretskii
@ 2021-10-25 8:02 ` Gregor Zattler
2021-10-25 12:41 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Gregor Zattler @ 2021-10-25 8:02 UTC (permalink / raw)
To: 51360
[sorry for second post, first did not include bug address]
Hi Eli, emacs devs,
* Eli Zaretskii <eliz@gnu.org> [2021-10-25; 05:27]:
>> From: Gregor Zattler <grfz@gmx.de>
>> Date: Sun, 24 Oct 2021 22:00:21 +0200
>>
>> > Whatever you do that you need server-name for, can't you do that in
>> > emacs-startup-hook? AFAIR, that gets called after the daemon already
>> > finished its initialization and provided its name to Emacs, so
>> > server-name should be already populated.
>>
>> the idea is to initialise the emacs daemon depending on it's
>> server-name. Therefore doing it via emacs-startup-hook is
>> somewhat counter-intuitive
>
> Sorry, I don't think I follow: what has intuition got to do with this?
> And what do you mean by "initialise the emacs daemon"? -- that happens
> out of your control, in the internal Emacs code.
>
>> But you are right that works. Thanks.
>
> So does this mean your problem is solved?
Yes, thanks. Please close the bug report.
Ciao,
--
Gregor
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-10-25 12:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23 18:39 bug#51360: 29.0.50; variable `server-name' initialized too late for use in init file Gregor Zattler
2021-10-24 12:46 ` Stefan Kangas
2021-10-24 15:34 ` Gregor Zattler
2021-10-24 15:45 ` Gregory Heytings
2021-10-24 19:42 ` Gregor Zattler
2021-10-24 15:59 ` Eli Zaretskii
2021-10-24 20:00 ` Gregor Zattler
2021-10-25 2:27 ` Eli Zaretskii
2021-10-25 8:02 ` Gregor Zattler
2021-10-25 12:41 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.