bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to run server-start only if not already running?


From: Reuben Thomas
Subject: Re: How to run server-start only if not already running?
Date: Tue, 6 Nov 2007 23:46:01 +0000 (GMT)

On Wed, 7 Nov 2007, Andreas Schwab wrote:

(when (and (file-exists-p (expand-file-name server-name server-socket-dir))
           (let ((status (call-process "/usr/bin/lsof"
                                       nil nil nil
                                       (expand-file-name server-name
                                                         server-socket-dir))))
             (or (not (numberp status)) (equal status 0))))
 (setq server-name (format "%s-%d" server-name (emacs-pid)))
 (add-hook 'kill-emacs-hook
   (lambda () (condition-case nil
                   (delete-file (expand-file-name server-name
                                                  server-socket-dir))
                 (error nil)))))
(server-start)

I needed to add (require 'server) to the start. After that it does exactly what I want, thanks.

--
http://rrt.sc3d.org/ | punline, n.  a punch line that really hurts




reply via email to

[Prev in Thread] Current Thread [Next in Thread]