scheme shell
about
download
support
resources
docu
links
 
scsh.net
From: George Demmy <gdemmy@layton-graphics.com>
Newsgroups: comp.lang.scheme.scsh
Subject: scsh-ilisp howto
Date: 31 May 2002 13:41:28 -0400
Organization: MindSpring Enterprises
Message-ID: <wu6614mczb.fsf@hades.layton-graphics.com>

The following is a first cut at how to get ilisp and scsh to play 
together. If there is any interest in this, I could start to pester
the ilisp maintainers for including scsh support out-of-the-box. I
wanted to have some of the implementation details nailed down before
I go knocking on that door.

G

-*- Mode: Text -*-

How to integrate scsh into ilisp.

Ilisp is a powerful emacs mode for interacting with an inferior
lisp. Lisp hackers have extended this mode to do nifty things, like
lookup documentation for lisp symbols from web sites. Presented here
for your consideration is a step-by-step procedure for integrating
scsh into ilisp. In the interest of simplicity, we focus here on scsh
integration, leaving references to others schemes and lisps out of
this discussion.

DISCLAIMER

This is one of many ways to do this... and it's likely not the
best. This document is much more a call for discussion or a cry for
help than the authoritative reference for scsh emacs integration.
Please relate your comments to me: gdemmy@layton-graphics.com

DOCUMENT INFO
Author: George Demmy
Date: 2002-05-31
This document in the public domain.

The Procedure

0) Got emacs and scsh... right?
1) Snarf Ilisp sources.
2) Modify Ilisp sources.
3) Compile Ilisp sources.
4) Install.
5) Configure your .emacs.


0) Got emacs and scsh... right?

Right.


1) Snarf Ilisp sources.

Grab the latest ilisp sources from:

  http://sourceforge.net/projects/ilisp

or update your xemacs ilisp package and do the install thing.
I updated my xemacs package using the package management features
found under the Options->Manage Packages menu. What I describe
certainly *might* work on other ilisp versions, but I don't know... I
haven't done it myself.


2) Modify Ilisp sources.

Edit ilisp-sch.el, wherein you describe scsh to ilisp.
I added this to the file -- it's a top level entry, so you should be
able to put it any where you like.

(defdialect scsh "scsh"
  scheme
  (setq ilisp-program "scsh"
      comint-prompt-regexp "^.*> "
      ilisp-eval-command 
      "(eval (read (make-string-input-port \"%s\")) (interaction-environment))"
      ilisp-set-directory-command "(chdir \"%s\")"))

The comint-prompt-regexp is a bit of a kludge, but it works.
Rolf-Thomas Happe suggested:

  I guess the regexp should rather be something like "^[^[:space:]]*> "
  since scheme48 and scsh may show prompts like "1> " or "srfi-13> "
  (when you have committed and error or gone ,in srfi-13 respectively).

I tried this, but scsh would hang... I guess comint couldn't match the
regex. There is much more to do -- this should be considered a bare
minimum. Examples of what could be done abound in ilisp-sch.el.


3) Compile Ilisp sources.

You can issue M-x byte-compile-file after you finish editing
ilisp-sch.el. This will create ilisp-sch.elc.

4) Install.

Replace the old ilisp-sch.elc with the new.


5) Configure your .emacs.

This is what I added to my .emacs, in all of its glory. It has my
clisp stuff in there is well, and is included for the sake of complete
disclosure. It's largely cut and paste from the example ilisp.emacs
that ships with ilisp. The scsh and scheme bits are fairly obvious. 

;;; begin ilisp customization 
(require 'completer)

;;; Autoload based on your Lisp. You only really need the one you
;;; use. If called with a prefix, you will be prompted for a
;;; buffer and program.

(autoload 'run-ilisp   "ilisp" "Select a new inferior Lisp." t)

(setq clisp-hs-program "clisp -I -q -ansi")
(setq cmulisp-program "lisp")
(setq scsh-program "scsh")
(setq mzscheme-program "mzscheme")
(setq guile-program "guile")

(set-default 'auto-mode-alist
	     (append '(("\\.lisp$" . lisp-mode)
                       ("\\.lsp$" . lisp-mode)
                       ("\\.cl$" . lisp-mode))
                     auto-mode-alist))

(setq lisp-mode-hook '(lambda () (require 'ilisp)))

(set-default 'auto-mode-alist
             (append '(("\\.scm$" . scheme-mode)
		       ("\\.scsh$" . scheme-mode)
                       ("\\.ss$" . scheme-mode))
                     auto-mode-alist))

(setq scheme-mode-hook '(lambda () (require 'ilisp)))

;;; Configuration of Erik Naggum's HyperSpec access package.

;; If you have a local copy of the HyperSpec, set its path here.
 (setq common-lisp-hyperspec-root
       "file:/usr/local/doc/HyperSpec/")
 (setq common-lisp-hyperspec-symbol-table
       "/usr/local/doc/HyperSpec/Data/Map_Sym.Txt")

;;; Sample load hook

(add-hook 'ilisp-load-hook
          '(lambda ()
             ;; Change default key prefix to C-c
             (setq ilisp-*prefix* "\C-c")

             ;; Set a keybinding for the COMMON-LISP-HYPERSPEC command
             (defkey-ilisp "" 'common-lisp-hyperspec)

             (message "Running ilisp-load-hook")

             ;; Set the inferior Lisp directory to the directory of
             ;; the buffer that spawned it on the first prompt.
             (add-hook 'ilisp-init-hook
                       '(lambda ()
                          (default-directory-lisp ilisp-last-buffer)))
             ))

;;; end ilisp


RUNNING (For those not familiar with comint or ilisp)

If you've got it all installed and you've evaluated the expressions in
your .emacs, you should be able to open a file, say "foo.scsh". You
can fire up the inferior scheme process with M-x run-ilisp. It will
prompt you for a dialect, to which answer "scsh". scsh should load up
into a buffer called *scsh*. You can evaluate expressions in foo.scsh
with scsh using C-c C-e. You can check out the other bindings in the
typical manner C-h b.

HACKING

That described here is only just enough to get ilisp talking to scsh
as an inferior lisp. There is still much that can be done, including
symbol completion and perhaps some interactive help.

Up