It is possible to run SCM, in interactive mode, within XEmacs, so that you can make use of XEmacs's editing features while submitting expressions for evaluation. Here's how it works.
When XEmacs is started, it inspects a configuration file named
.emacs
in your home directory. (The file is actually a
program in Emacs Lisp, a Scheme-like language that the XEmacs editor uses
internally.) Edit this file and insert the following lines at any point
where there is currently a blank line:
;; Define a command for running SCM and bind it to the F1 key. (defun run-scm () (interactive "*") (if (< (count-windows) 2) (split-window)) (run-scheme "/usr/local/bin/scm -p1")) (global-set-key [f1] 'run-scm) ;; Use the enter key to ask SCM to evaluate an expression. (global-set-key [kp_enter] 'xscheme-send-previous-expression)Save the file, then exit from XEmacs and start it up again.
At this point, pressing the F1 key will cause XEmacs to divide the editing window into two separate subwindows. The bottom subwindow is for editing files; in the top subwindow, SCM is running, and you can type in definitions and expressions and get the usual results back.
There is one major difference in the user interface: Since SCM can no
longer tell when you've finished editing by watching the carriage returns,
you need to send it a specific signal to tell it that you're ready to have
the expression evaluated or the definition elaborated. The
Enter
key in the lower right-hand corner of the numeric keypad
sends this message.
Secondly, control-D does not have the effect of halting SCM under XEmacs (in XEmacs, control-D means ``delete the character under the cursor''); instead, you have to use the XEmacs command control/X control/K.
In some ways it's a little inconvenient to have two subwindows, but you can always move from one to the other by moving the mouse into the other one and clicking the left mouse button. Cutting and pasting works between the windows. If you decide to open a different file in the bottom subwindow, remember to click in it before clicking on the dog-eared-page icon -- the new file will replace whichever subwindow you performed the last operation in.