From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Liang Wang Newsgroups: gmane.emacs.bugs Subject: server-running-p: not detect server running by other emacs instance Date: Sat, 5 Apr 2008 05:29:52 -0700 (PDT) Organization: http://groups.google.com Message-ID: <38db448b-c6e9-45b5-a76e-73cee4ea053d@z24g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207410410 32750 80.91.229.12 (5 Apr 2008 15:46:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Apr 2008 15:46:50 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 05 17:47:23 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JiAbq-0007lJ-9B for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Apr 2008 17:47:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JiAbD-0000xN-HY for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Apr 2008 11:46:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!z24g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 29 Original-NNTP-Posting-Host: 58.100.138.110 Original-X-Trace: posting.google.com 1207398592 24101 127.0.0.1 (5 Apr 2008 12:29:52 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 5 Apr 2008 12:29:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z24g2000prf.googlegroups.com; posting-host=58.100.138.110; posting-account=IOLthAoAAAC7SW_PJWY-3HJ-n3ooDuta User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13,gzip(gfe),gzip(gfe) Original-Xref: shelby.stanford.edu gnu.emacs.bug:44719 X-Mailman-Approved-At: Sat, 05 Apr 2008 11:46:21 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17805 Archived-At: I modify server-running-p in server.el to make it to detect server running by other emacs instance. With this modification, server started by first emacs instance won't be killed by successive instances. (unless (server-running-p) (server-start)) I replace server-socket-dir with (or server-socket-dir (format "/tmp/ emacs%d" (user-uid))) since server-socket-dir only set by server- start. Here is whole function. (defun server-running-p (&optional name) "Test whether server NAME is running." (interactive (list (if current-prefix-arg (read-string "Server name: " nil nil server-name)))) (unless name (setq name server-name)) (condition-case nil (progn (delete-process (make-network-process :name "server-client-test" :family 'local :server nil :noquery t :service (expand-file-name name (or server-socket-dir (format "/tmp/emacs%d" (user-uid)))))) t) (file-error nil))) Does this make sense to be a patch to emacs?