When starting a server it's possible to set a name for the server (http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html). These names are to be useful for connecting emacsclients to those servers, however it would be nice to switch some behavior in my config based on the server name(my initial thoughts are changing the theme).
I've dug around on google and the best way seems to be setting an env var and then reading that back in the configuration (http://www.emacswiki.org/emacs/EmacsAsDaemon#toc13). I can't seem to find a way to get this information from within emacs without setting the env var, and I'd rather not have to run a separate wrapper just to know what server is running. How would I go about finding this information programmatically?
daemonp
is a predicate, it either returnst
ornil
. – wasamasa Mar 13 '15 at 11:12daemonp
is returning the name of the server. I updated the sample to usestring=
becausedaemonp
will returnnil
if emacs isn't running a server. – Aaron Lee Mar 13 '15 at 11:46daemonp
can do both. For the server it can return either its name ornil
, for the client it can be botht
andnil
. This is pretty bonkers considering there's theserver-name
variable, yet no exposeddaemon-name
variable. – wasamasa Mar 13 '15 at 11:53daemonp is a built-in function in
C source code'. (daemonp)I suggest you to accept your own answer
– Joafigue Aug 28 '15 at 23:41