Question: 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?

Answer: 
It appears `daemonp` will return the name of the server. I ended up with code that looks something like

```
(cond
 ((string= "org" (daemonp))
  (load-theme 'solarized-light)
 )
 (t
  (load-theme 'solarized-dark)
 )
)

```
In a client instance the variable `server-name` is bound and contains the server name.

```
(and (boundp 'server-name) server-name)

```