From: Klaus Zeitler <kzeitler+usenet@gsm-mailhost.de.lucent.com>
Subject: Re: server-start preempted by other emacs window
Date: 29 Jan 2004 08:19:59 +0100 [thread overview]
Message-ID: <q5gk73bql0g.fsf@lucent.com> (raw)
In-Reply-To: m3vfmwxc98.fsf@cisco.com
>>>>> "John" == John Russell <jorussel@cisco.com> writes:
John>
John> Is there a way to have emacs check to see if another server process
John> is running before it runs server-start?
John>
John> My issue is that if I have one emacs window open (my IDE) and then
I'm not sure what you mean with window here. I guess you mean a 2nd emacs.
For emacs a window is something different.
John> open another one for gnus, the last one opened always destroys any
John> server process in existence. So all emacsclient calls go to the gnus
John> window, and when that window gets closed, there is no longer any
John> server running at all.
I've been using the following for years. I'm using gnuserv/gnudoit instead
of the standard emacsclient. It's been a long time that I've used emacsclient,
and IIRC old versions could only accept a file and no elisp code. I think
that was the reason why I switched to gnuserv/gnudoit. Thus I'm not sure
if one can do this similar with emacsclient. I think at least CVS emacs
has an improved emacsclient.
;; The following function allows to check if a server process is already running
;; (in case we start more than one emacs)
(defun gnuserv-running-p () "Checks whether a useful gnuserv is already running"
(let ((output "")
(proc (condition-case ()
(start-process "gnudoit" nil "gnudoit" "1234")
(error nil))))
(if proc
(progn
(set-process-filter proc
(function
(lambda (proc string)
(setq output (concat output string)))))
;; wait for output from gnudoit with a timeout of 4 seconds
(accept-process-output proc 4)
(set-process-filter proc nil)
;;(message "server check returns: '%s'" output)
(eq (string-match "1234" output) 0)))))
(if (gnuserv-running-p)
(message "Server is already running")
(gnuserv-start))
HTH
Klaus
--
------------------------------------------
| Klaus Zeitler Lucent Technologies |
------------------------------------------
---
My opinions may have changed, but not the fact that I am right.
prev parent reply other threads:[~2004-01-29 7:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-28 16:34 server-start preempted by other emacs window John Russell
2004-01-28 18:33 ` Stefan Monnier
2004-01-28 20:33 ` John Russell
2004-01-29 16:52 ` Stefan Monnier
2004-01-29 18:39 ` Thorsten Bonow
2004-01-29 21:11 ` kgold
2004-02-08 9:50 ` Jari Aalto+mail.linux
2004-01-28 18:43 ` Kevin Rodgers
2004-01-28 20:31 ` John Russell
2004-01-29 7:19 ` Klaus Zeitler [this message]
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=q5gk73bql0g.fsf@lucent.com \
--to=kzeitler+usenet@gsm-mailhost.de.lucent.com \
/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.