[gnu.emacs] Info. Request: Invoking GNU Emacs from Lisp on a SUN

dsouza@cadillac.CAD.MCC.COM (Desmond Dsouza) (11/04/88)

I need to use GNU Emacs as an editor from a program I have in Common Lisp on 
SUN/UNIX. Ideally I would like to do this from both Sun Common Lisp and KCL, but
any information is most welcome. (Both Lisps can call C functions or execute
shell commands).

Here is what I wish to do:
===============================================================
	In Lisp, upon certain user commands, I wish to bring up a Emacs window for
	the user to edit. This could be much like a function call, as I do not
	wish Lisp to do anything until the Emacs interaction is over.
	I would like to pass the window certain strings to be displayed at certain
	positions (if necessary, could I do this through files?). I would also
	like the Emacs buffer to have certain (modified Lisp-like) syntax and
	indentation behaviour, and would like to define my own keystroke sequences.

	When the user is done, some keystrokes should return control to my program,
	with the edited text accessible in some form (maybe a file).
===============================================================

Questions:
	Would anyone out in NetLand who has done something like this give me a brief
	outline of a good way to go about this?

	What documentation should I read? Is there a programmer's manual for GNU Emacs?
	If there is EMAIL-able documentation, I'd appreciate a copy.

	Is communication through text files necessary?

	How do I set up my own syntax, indentation and keystrokes?

	Do I need to get into the hair of IPC and sockets and such, or is an easier 
	interface available?

Thanks in advance --- Desmond D'Souza (MCC-CAD, Austin, TX)
-- 
 Desmond D'Souza, MCC CAD Program | ARPA: dsouza@mcc.com | Phone: [512] 338-3324
 Box 200195, Austin, TX 78720 | UUCP: {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!cadillac!dsouza

worley@EDDIE.MIT.EDU (Dale Worley) (11/07/88)

The closest to "bringing up an Emacs window" is to invoke the program
"emacsclient" (with one or more filenames as arguments).  emacsclient
sends an IPC message to your Emacs (which must have previously run the
command 'server-start').  Emacs receives the message, and brings up a
window.  When you type C-x # at the window, Emacs sends an "I'm done"
message to emacsclient.

If you want to communicate text with the Emacs, you have to put it in
files (unless you want to hack the client/server code), but that is
not unreasonable.

As far as I know, there is no way to use emacsclient to force the
buffer into a particular mode directly, but (since the server code
uses find-file) you can use the extension to force the buffer into a
mode (see var. auto-mode-alist), or use local variable settings in the
text file.

Perhaps emacsclient should be modified to support some of the Emacs
startup options (+linenumber, -f function, etc.).

Dale