Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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.

share|improve this answer

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

(require 'server)
(unless (server-running-p)
    (server-start))
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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