[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a Semi-working CLISP with ILISP in Emacs



Hi, 

I Have hacked an ilisp-mode to get clisp working with ilisp. 
I'm not very familier with emacs-lisp so the following is actually
done by looking at other code and trial-and-error. But it works for
the most part. 

The ilisp package resides in /usr/emacs/ilisp
The clisp package resides in /usr/local/lib/lisp

The necessery code is spread into two files. One part is in
$HOME/.emacs and the other is in /usr/local/lib/lisp/emacs.el. I can
start lisp from emacs by executing the 'zlisp' extended command (M-X
zlisp) or by issuing the following script from shell

#!/bin/bash
exec emacs -l /usr/local/lib/lisp/emacs.el -f zlisp

Finally, attached is what appears in my $HOME/.emacs and
/usr/local/lib/ilisp/emacs.el. Please report any problems to me and I
would be interested in seeing any enhancements. 

Hope that helps, 

 - Ziad
   najem@cs.uiuc.edu


***********************************************************************
		  Begin Code taken from $HOME/.emacs
***********************************************************************

(autoload 'zlisp "/usr/local/lib/lisp/emacs" "Z-Lisp" t)

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

(defvar ziad:cl-indent-loaded nil)
(setq lisp-mode-hook 
      '(lambda () 
	(require 'zlisp "/usr/local/lib/lisp/emacs")
	(if ziad:cl-indent-loaded
	    nil
	  (load "cl-indent")
	  (setq ziad:cl-indent-loaded t))
	(turn-on-auto-fill)
	(setq fill-column 75)
	(setq comment-column 25)
	(setq completion-ignored-extensions
	 (append '(".lib" ".fas") completion-ignored-extensions))
	(setup-gnu-indentation)
	))

(defun setup-gnu-indentation ()
  (let ((tag 'common-lisp-indent-hook))

    (put 'defpackage      tag 1)
    (put 'if              tag 2)

;;; For Minerva in Lisp
    (put 'internalize      tag (get 'do tag))
    (put 'in-kb            tag '(4 2))
    (put 'if-prolog        tag (get 'if tag))
    (put 'if-prolog-let    tag '(6 6 4 2))
    (put 'when-prolog      tag (get 'when tag))
    (put 'when-prolog-let  tag '(6 4 2))
    (put 'unless-prolog    tag (get 'unless tag))
    (put 'while-prolog     tag (get 'when tag))
    (put 'while-prolog-let tag (get 'do tag))
    (put 'var-let          tag (get 'let tag))
    (put 'lisp-prover      tag (get 'defun tag))
    (put 'p-unify          tag (get 'defun tag))
    (setq lisp-indent-hook 'common-lisp-indent-hook)
    ))
***********************************************************************
		   End Code taken from $HOME/.emacs
***********************************************************************



***********************************************************************
	  Begin Code taken from /usr/local/lib/lisp/emacs.el
***********************************************************************

(setq load-path (cons "/usr/emacs/ilisp" load-path))

(setq ilisp-load-hook 
  '(lambda ()
    (setq ilisp-prefix "\C-c"
	  zlisp-program "/usr/local/lib/lisp/lisp.run -q -M /usr/local/lib/lisp/lispinit.mem -i /usr/local/lib/lisp/cltl2")))

(require 'ilisp)

(defun zlisp-check-prompt (old new)
  "Compare the break level printed at the beginning of the prompt."
  (let* ((old-level (if (and old (string-match "[0-9]+" old))
		       (string-to-int (substring old (match-beginning 0) 
						 (match-end 0)))
		       0))

	 (new-level (if (string-match "[0-9]+" new)
			(string-to-int (substring new (match-beginning 0) 
						  (match-end 0)))
			0)))
    (<= new-level old-level)))


(defdialect zlisp "Linux CLisp"
  clisp
  (ilisp-load-init 'zlisp "/usr/emacs/ilisp/clisp.lisp")
  
  (setq 
   ilisp-load-or-send-command 
   "(and (or (print \"%s\") t) (load \"%s\"))"
   
   ilisp-binary-extension "fas"
   ilisp-motd "Zodiac-Lisp V%s"
   comint-prompt-regexp "^[^> \t]*>"
   ilisp-other-prompt "^[ \t]+"
   comint-fix-error "unwind"
   comint-continue "continue"	
   comint-interrupt-regexp "\*\* \- Continuable Error"
   lisp-wait-p t
   lisp-no-popper nil
	      
   comint-prompt-status 
   (function (lambda (old line) 
	       (comint-prompt-status 
		old line 'zlisp-check-prompt)))))


(provide 'zlisp)
(require 'cl)
(load "fi/utils.el")
(load "fi/indent.el")


***********************************************************************
	   End Code taken from /usr/local/lib/lisp/emacs.el
***********************************************************************