[lice @ shit loads of stuff]
[lice.git] / src / elisp.lisp
blobc6dc398dee6a2bd944400ff34da65bebcea726ea
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 parse-interactive"))
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)))))