[ home | photos | gallery | scheme | notes | blog | facebook | twitter | youtube | last.fm | myspace | del.icio.us | EverythingHerePlus ]
While the run-kawa.el code is trivial, it is useful for anyone running Kawa in a Unix environment. There may be better Scheme modes out there, but the cmuscheme code seems ubiquitous. If you have a better setup for running Kawa, please notify me and I will attempt to document it. This tuturial is geared towards MacOSX users that probably have little or no experience with emacs.
This emacs lisps code calls the kawa shell script, so it only works if Kawa has been installed via 'make install' in the build process. If you don't have privileges to install there are ways to work around the script not being in the expected path.
(defun run-kawa () "Run Kawa Scheme in an Emacs buffer." (interactive) (require 'cmuscheme) (let ((scheme-program-name "/usr/local/bin/kawa")) ; (let ((scheme-program-name "/Users/Shared/bin/kawa")) ; my installation (run-scheme scheme-program-name)))
To execute the code, load it in to a buffer and execute it by choosing 'Evaluate Buffer' from the 'Emacs-Lisp' menu. Better yet, save the code in a
.emacs file in your home directory to execute on startup.
Once the lisp code is loaded, running Kawa is a simple matter of typing (M-x run-kawa) 'Meta'-X (alt-key) and then typing 'run-kawa' in the mini buffer. Emacs will run Kawa in an 'Inferior Scheme Mode' and adds menus for interacting with the repl. Since Emacs allows you to split a frame (window) into multiple windows, you can have code you are editing in one window and the Kawa repl in the other. This is anogolous to multiple 'panes' in Macintosh or Windows terminology. To do this choose 'Split Window' from the 'Files' menu (C-x 2). To switch between buffers type (C-x o).
Emacs needs to be informed that source in a buffer is Scheme. This mode is entered by typing (M-x scheme-mode RET). The following header at the begining of a Scheme source file will cause Emacs to automatically enter this mode, although most Emacs configurations will guess this from the source file extension.
; -*-scheme-*- ;;; often people include the author and email on the same line, as in this alternative ; -*-scheme-*- Robert D. Skeels 2001 <email@example.com>
If you are new to Emacs, its terminology may be daunting. For OSX users this is compounded by the fact that Apple's terminals don't behave like Xterms that allow the mouse to access emacs menus. While it is best to read one of the numerous books on Emacs and to read the Emacs man and info pages, a few things are covered here. Keyboard commands differ from those under typical MacOS applications, but are not too difficult to learn.
|Abbreviated||Emacs Key||Macintosh Key||PC Key|