I'm running Emacs 23 in Debian Squeeze. ~/.emacs does not contain any server-related commands.

I launch Emacs and enter C-h v server-mode, which returns nil, as no server is running. I then enter M-x start-server, which starts an Emacs server in the running instance of Emacs.

However, the variable server-mode is still nil when I check it again. Only after running M-x server-mode, does variable server-mode get a value of t. Is this a bug or am I doing something wrong?

Server-mode works fine after entering start-server; I can use emacsclient to open a file in the Emacs server. However, I wanted to use variable server-mode in the mode-line to indicate if the server is running, but if starting the server with start-server does not change the value of server-mode, this will not work as expected.


A better way is to use (server-running-p) from server package. For example

(require 'server)
(unless (server-running-p)

To get the functionality I need/expect (from a freshly-started Emacs), I run M-x server-mode to start the server, rather than server-start. Starting the server this way changes the value of variable server-mode to t.

I do not understand why starting the server with the documented server-start does not set the variable server-mode to t.

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.