Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!munnari!otc!metro!basser!natmlab!neilc From: neilc@natmlab.dms.oz (Neil Crellin) Newsgroups: comp.emacs Subject: Re: GNUemacs server/client mode Message-ID: <5132@natmlab.dms.oz> Date: 7 Mar 89 17:51:23 GMT References: Sender: news@natmlab.dms.oz Reply-To: neilc@natmlab.dms.oz (Neil Crellin) Organization: CSIRO Division of Mathematics and Statistics Lines: 57 In-reply-to: gnb@bby.oz (Gregory N. Bond) In article , gnb@bby (Gregory N. Bond) writes: >[I have previously posted this to an aus distribution and got no reply] Sorry Greg, I saw it there but was snowed under. >I am looking for pointers or information on the client/server mode of >GNUemacs. I have found the client and server programs but can't work >out how they are suppoed to be used, and can't find anything in the FM. In etc/NEWS we find the following: (Try also C-h f server-start and look at lisp/server.el) * Existing Emacs usable as a server. Programs such as mailers that invoke "the editor" as an inferior to edit some text can now be told to use an existing Emacs process instead of creating a new editor. To do this, you must have an Emacs process running and capable of doing terminal I/O at the time you want to invoke it. This means that either you are using a window system and give Emacs a separate window or you run the other programs as inferiors of Emacs (such as, using M-x shell). First prepare the existing Emacs process by loading the `server' library and executing M-x server-start. (Your .emacs can do this automatically.) Now tell the other programs to use, as "the editor", the Emacs client program (etc/emacsclient, located in the same directory as this file). This can be done by setting the environment variable EDITOR. When another program invokes the emacsclient as "the editor", the client actually transfers the file names to be edited to the existing Emacs, which automatically visits the files. When you are done editing a buffer for a client, do C-x # (server-edit). This marks that buffer as done, and selects the next buffer that the client asked for. When all the buffers requested by a client are marked in this way, Emacs tells the client program to exit, so that the program that invoked "the editor" will resume execution. You can only have one server Emacs at a time, but multiple client programs can put in requests at the same time. The client/server work only on Berkeley Unix, since they use the Berkeley sockets mechanism for their communication. >My understanding is that this will allow me to use one emacs process >(which is quite large) as a server and several clients as the editor >for MH/rn/4GL and other "call editors within an application" uses, >without continual creating/destroying emacs processes. Sounds that way. Have fun. -- Neil Crellin, CSIRO Maths and Stats, Sydney, Australia. (neilc@natmlab.oz.au) PO Box 218, Lindfield, NSW 2070. (ph) +61 2 467 6721 (fax) +61 2 416 9317