[lice @ more rearranging. define-key modifications to accomodate bindings.lisp. this...
[lice.git] / src / elisp.lisp
blob4314a71621eee6f754dcc3db5d74de9c68d1d856
1 (cl:defpackage "ELISP"
2 (:nicknames "EL")
3 (:use "CL")
4 (:shadow cl:if cl:defun)
5 (:export #:if #:defun))
7 (in-package "ELISP")
9 (defmacro if (test pass &rest else)
10 "Elisp version of IF."
11 `(cl:if ,test
12 ,pass
13 (progn
14 ,@else)))
17 (cl:defun parse-interactive (thing)
18 (error "unimplemented"))
20 (defmacro defun (name lambda-list &body body)
21 "Parse an elisp style defun and convert it to a cl defun or lice defcommand."
22 (let ((doc (when (stringp (car body))
23 (pop body)))
24 (decls (loop while (eq (caar body) 'declare)
25 collect (pop body)))
26 (interactive (when (and (listp (car body))
27 (eq (caar body) 'interactive))
28 (pop body))))
29 (if interactive
30 `(defcommand ,name (,lambda-list
31 ,@(parse-interactive (cdr interactive)))
32 ,@(append (list doc) decls body))
33 `(cl:defun ,name ,@(append (list doc) decls body)))))