I\'m trying to check if server-running-p
is available in my .emacs file before calling it. I already have the following:
(if (not (server-runnin
A simpler way is to use "require" to make sure the server code is loaded. Here's what I use:
(require 'server)
(unless (server-running-p)
(server-start))
ryuslash’s suggestion was really helpful, but I modified it for my .emacs:
(unless (and (fboundp 'server-running-p)
(server-running-p))
(server-start))
This gets the server running even if server.el hasn't been loaded—server-running-p
is only defined when server.el is loaded, and server-start
is autoloaded.
boundp
checks to see if a variable is bound. Since server-running-p
is a function you'll want to use fboundp
. Like so:
(if (and (fboundp 'server-running-p)
(not (server-running-p)))
(server-start))