I'm using emacs 25.2.1 on Windows with spacemacs (0.200.9). I also start emacs as a service using emacsclientw.exe --daemon
. I'm attempting to get the current host name using (system-name)
as follows:
(defconst jp-hostname
(car (split-string (system-name) "\\." t)))
Unfortunately, when I do this, the jp-hostname
variable contains the NETBIOS name instead of the hostname. For example, my laptop's name is "jaundiced-outlook", but jp-hostname
is set to "JAUNDICED-OUTLO".
Calling (system-name)
after emacs is up and running returns what I would expect: "jaundiced-outlook".
By waiting until emacs is finished loading and executing the above code using eval-region
, jp-hostname
gets set correctly to "jaundiced-outlook".
Is there a reason for this behavior? Is there a way to get around this kind of thing?