Previous: , Up: Running   [Contents][Index]


22.7 Running an External Lisp

Emacs has facilities for running programs in other Lisp systems. You can run a Lisp process as an inferior of Emacs, and pass expressions to it to be evaluated. You can also pass changed function definitions directly from the Emacs buffers in which you edit the Lisp programs to the inferior Lisp process.

To run an inferior Lisp process, type M-x run-lisp. This runs the program named lisp, the same program you would run by typing lisp as a shell command, with both input and output going through an Emacs buffer named ‘*lisp*’. In other words, any “terminal output” from Lisp will go into the buffer, advancing point, and any “terminal input” for Lisp comes from text in the buffer. To give input to Lisp, go to the end of the buffer and type the input, terminated by RET. The ‘*lisp*’ buffer is in Inferior Lisp mode, which has all the special characteristics of Lisp mode and Shell mode (see Shell Mode).

Use Lisp mode to run the source files of programs in external Lisps. You can select this mode with M-x lisp-mode. It is used automatically for files whose names end in .l or .lisp, as most Lisp systems usually expect.

When you edit a function in a Lisp program you are running, the easiest way to send the changed definition to the inferior Lisp process is the key C-M-x. In Lisp mode, this key runs the function lisp-send-defun, which finds the defun around or following point and sends it as input to the Lisp process. (Emacs can send input to any inferior process regardless of what buffer is current.)

Contrast the meanings of C-M-x in Lisp mode (for editing programs to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp programs to be run in Emacs): in both modes it has the effect of installing the function definition that point is in, but the way of doing so is different according to where the relevant Lisp environment is found. See Lisp Modes.


Previous: , Up: Running   [Contents][Index]