all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reuben Thomas <rrt@sc3d.org>
To: Andreas Schwab <schwab@suse.de>
Cc: Emacs Bugs <bug-gnu-emacs@gnu.org>
Subject: Re: How to run server-start only if not already running?
Date: Tue, 6 Nov 2007 23:46:01 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.0.9999.0711062342590.4611@localhost.localdomain> (raw)
In-Reply-To: <jer6j3rlpo.fsf@sykes.suse.de>

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




  parent reply	other threads:[~2007-11-06 23:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06 21:41 How to run server-start only if not already running? Reuben Thomas
2007-11-06 23:35 ` Andreas Schwab
2007-11-06 23:38   ` Reuben Thomas
2007-11-06 23:56     ` Lennart Borgman (gmail)
2007-11-07  0:00       ` Reuben Thomas
2007-11-06 23:46   ` Reuben Thomas [this message]
2007-11-07  7:56   ` Richard Stallman
2007-11-07  9:42     ` Andreas Schwab
2007-11-08  4:41       ` Richard Stallman
2007-11-08  9:49         ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.0.9999.0711062342590.4611@localhost.localdomain \
    --to=rrt@sc3d.org \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.