Success with ILISP/Corman (Was: Anyone using Emacs/ILISP with Corman Common Lisp?)
Edi Weitz <[email protected]>
| Newsgroups | gmane.lisp.corman,gmane.lisp.ilisp.devel |
|---|---|
| Message-ID | <[email protected]> |
OK, I've made some progress with Corman Lisp 2.0 and ILISP. Here's a
preliminary report of what I've done. Please note that this is barely
tested and I can currently only really confirm that it runs on my
machine[*] (Windows XP pro, Emacs 21.2). To make matters worse I don't
know much about Windows either...
1. Make sure you have Corman Lisp 2.0 with all patches from
<http://www.cormanlisp.com/CormanLisp/patches/2_0/>. (Don't know if
that's really needed but it won't hurt either...)
2. Get current ILISP from CVS and install according to Bill Clementson's
instructions from <http://cl-cookbook.sourceforge.net/windows.html>.
3. The file cormanlisp.lisp in the ILISP directory has a test
(unless (fboundp 'compile-file-pathname)
...
Unfortunately, this won't work with Corman Lisp 2.0 as
COMPILE-FILE-PATHNAME is FBOUND but not implemented... :) Replace
the test with something like
(unless (ignore-errors (compile-file-pathname "foo.lisp"))
...
4. In order to get reasonable argument lists we can use two functions
from the CORMANLISP package but they won't help for functions or
macros in the CL package. Luckily, the missing arguments lists are
easy to obtain from the CormanLisp.exe executable. I won't include
the file that I produced with this mail because of copyright issues
but here is how to obtain it. (This is done from within a Cygwin
Bash Shell. Don't know how to do this with Microsoft tools.)
'cd' into the Corman Lisp directory and issue the two following
commands. (Note that these are two long lines. Your email client
will most likely wrap them.)
echo -e "(in-package :ilisp)\n(defparameter **cormanlisp-arglists* * (make-hash-table :test #'eq))" >/tmp/cormanlisp-arglists.lisp
strings CormanLisp.exe | egrep '\[Macro\]|\[Function\]|\[Special Operator\]' | perl -p -e "s/^(\\S+)\\s*(.*[\\S]|)\\s*\\[[^[]+\\]\$/(setf (gethash 'CL:\$1 **cormanlisp-arglists**) \"\$2\")/" >>/tmp/cormanlisp-arglists.lisp
Now copy or move the resulting file /tmp/cormanlisp-arglists.lisp
into your ILISP directory.
5. Add the following code to cl-ilisp.lisp in the ILISP directory:
#+:cormanlisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(load (make-pathname :name "cormanlisp-arglists"
:type "lisp"
:version nil
:defaults (parse-namestring *load-truename*))))
#+:cormanlisp
(defun cormanlisp-arglist (symbol)
(cond ((gethash symbol *cormanlisp-arglists*))
((macro-function symbol)
(cormanlisp::macro-lambda-list (symbol-function symbol)))
((fboundp symbol)
(cormanlisp::function-lambda-list (symbol-function symbol)))
(t nil)))
6. Within GET-FUNCTION-ARGLIST in cl-ilisp.lisp add the clause
#+:cormanlisp
(cormanlisp-arglist symbol)
and change
#-(or allegro lucid kcl ibcl ecl gcl lispworks clisp cmu :sbcl :openmcl)
to
#-(or allegro lucid kcl ibcl ecl gcl lispworks clisp cmu :cormanlisp :sbcl :openmcl)
7. Now start Corman Lisp and LOAD the files cl-ilisp.lisp,
ilisp-pkg.lisp, and cormanlisp.lisp. Then use SAVE-IMAGE to create
a new image, say, ILISP.IMG.
8. In your .emacs or .ilisp file add the following lines (or modify
them depending on where your copy of Corman Lisp is located):
(defvar cormanlisp-dir "C:\\PROGRA~1\\CORMAN~2\\CORMAN~1.0\\")
(defvar cormanlisp-exe (concat cormanlisp-dir "CLCONS~2.EXE"))
(defvar cormanlisp-program (concat cormanlisp-exe " -image " cormanlisp-dir "ILISP.IMG"))
(autoload 'cormanlisp "ilisp" "Inferior Corman Common Lisp." t)
Make sure you use the short DOS filenames which can be obtained by
'dir /x'. Note that we use ILISP.IMG here which was created in step 7.
9. The last thing is to make sure that ILISP doesn't try to initialize
itself on each prompt. The kludge I came up with is to add a hook
to ilisp-init-hook. My .ilisp file now contains the following
lines:
(add-hook 'ilisp-load-hook
'(lambda ()
(setq ilisp-*prefix* "\C-c")
(defkey-ilisp "" 'common-lisp-hyperspec)
(message "Running ilisp-load-hook")
(add-hook 'ilisp-init-hook
'(lambda ()
(default-directory-lisp ilisp-last-buffer)))
(add-hook 'ilisp-init-hook
'(lambda ()
(when (search "CORMAN" ilisp-program :test #'char-equal)
(setq ilisp-initialized
(cons (buffer-name (current-buffer)) ilisp-initialized)))))))
(Of course, only the last add-hook is really necessary. The rest is
what was there already.)
With these modifications you should be able to use Corman Lisp from
ILISP and play around with it (unless I forgot something). I'm sure
there are a lot more things to fix and I hope someone more
knowledgeable than me will help out. More to come as soon as I find
some time...
Have fun,
Edi.
[*] which is the reason why I don't send patches
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/FpY02D/vN2EAA/xGHJAA/SyjtlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/