lunes, 21 de febrero de 2011

run interactive applications inside emacs

While implementing a more decent repl for HAScheme, I stumbled upon a nifty emacs feature: comint.

To run an interactive shell, get history for free, and completion (at least hippie-expand if you teach your emacs to use it), you just have to use make-comint.

(defun run-has ()
(make-comint "has" "/path/to/hascheme/script/" nil "/path/to/hascheme/script/builtins.scm"))

the last parameter is the argv, you can fill it with whatever you want. In my case, the scheme file with some builtins.

On the hascheme side, I've been experimenting with tail call optimitzation, an improved repl with multiline support and with some cool debugging features. You'll know shortly about them if you follow this little blog of mine.

Well, and here's a screenshot of the comint buffer on hascheme. note the completion thing on the minibuffer.