[comp.emacs] Server and Client

brian@hall.CRAY.COM (Brian Utterback) (04/29/88)

What is the purpose of the emacserver and  emacsclient?  Can they be used to
edit a file on another machine across a network?

Brian Utterback     |UUCP:{ihnp4!cray,sun!tundra}!hall!blu |   "Aunt Pheobe,
Cray Research Inc.  |ARPA:blu%hall.cray.com@uc.msc.umn.edu |     we looked 
One Tara Blvd. #301 |                                      |   like Smurfs."
Nashua NH. 03062    |Tele:(603) 888-3083                   |

mdb@amadeus.silvlis.COM (Mark D. Baushke) (04/29/88)

>  Date: Thu, 28 Apr 88 13:06:37 EDT
>  From: sun!uc.msc.umn.edu!darkstar!brian%hall.CRAY.COM (Brian Utterback)
>  
>  What is the purpose of the emacserver and  emacsclient?  

The best use of emacsclient is when you are in a window system (e.g.,
X11 or suntools) and you have a copy of emacs running. From that copy
issue the M-x server-start command.

Start the window-system such that every new shell will inherit/execute the
following two commands:

	setenv EDITOR emacsclient
	alias emacs $EDITOR

For programs that invoke $EDITOR, you will be able to modify the file
from inside of your already existing emacs. This reduces the start-up
time to get at the file. Using emacsclient could also improve the
performance of your machine (by not having to start another "heavy"
process).

Examples of programs that use $EDITOR

	vipw
	mh
        Saber-C
	IDETool

>  Can they be used to edit a file on another machine across a
>  network?

No. The current emacsclient creates a socket on the local machine.

Mark Baushke
mdb@silvlis.com		<-- finally, our domain is registered with NIC
silvlis!mdb@sun.com	    Note: silvlis.com does NOT have an Internet Port

gaynor@ARAMIS.RUTGERS.EDU (Silver) (04/29/88)

The server/client scheme is also convenient on machines which labor
under high loads, regardless of whether you're using a window system.
With a load of 25, you could have a quick lunch while emacs starts up.
:-)  I've had luck with something along the following scheme, under
BSD/SunOS with 18.49 on a glass tty:

  start an emacs server and suspend it
  define EDITOR to client
  run an application which runs $EDITOR
  suspend application
  continue server
  C-x # away the buffers that need it
  suspend server
  continue application

Hmmm.  I wonder how difficult it would be to make things so that
emacsclient automatically suspends it's parent process and continues
the server emacs...  Any ideas?

Regards,
[Ag]

karl@triceratops.cis.ohio-state.edu (Karl Kleinpaste) (04/29/88)

   Hmmm.  I wonder how difficult it would be to make things so that
   emacsclient automatically suspends its parent process and continues
   the server emacs...  Any ideas?

It will be very difficult indeed.  When the emacsclient suspends
itself, your shell will hear about it and expect to give you a new
prompt due to a normal job-stop.  Convincing the shell that something
else should be automatically considered the running foreground process
could be quite a neat trick.  About the only way to do it is to have
emacsclient stuff a "fg %emacs" command into the terminal data stream
via TIOCSTI - ugly and dangerous at best.

--Karl