1

I have a few Emacs servers running on my computer, and a few clients are attached to these servers. Is there a way to get which server a client is attached to from the window?

  • 1
    Please clarify how you arrange to have several Emacs servers running on your machine (are they running under different user-ids, or do you use something like server-name, ...?). Please clarify also what you mean by "from the window". E.g. show an example of the way you'd like to be able to distinguish them. – Stefan Jun 4 at 15:47
  • Thanks. I am new to emacs. I would like to run daemons by emacs --daemon=NAME with a few different NAMEs and open a window by emacsclient -c -s NAME. The question is how to learn NAME from the window. – user50394 Jun 10 at 17:38
1

At a pinch, (emacs-pid) will give you the server's process ID.

In typical cases, C-hv server-name is probably going to tell you what you need to know.

For example if you are simply using emacs --daemon=NAME and connecting with emacsclient -s NAME, then server-name will have the value NAME.

(expand-file-name server-name server-socket-dir) is more specific, if there's a chance of the socket directory varying.

If you're using TCP sockets instead of local sockets then things are a bit different again, with server-auth-dir being used.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.