X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=static.el;h=039fc06d145c8730ba77cedcd74ac533b5cc23b4;hb=961193295ae71b9e98645fe19000f638fc3d2651;hp=669e25f58706a29c415a5a43674ccdfbeb83353c;hpb=c4fcdb4c08c1131a3afb18c64b0e013b251ffb97;p=elisp%2Fapel.git diff --git a/static.el b/static.el index 669e25f..039fc06 100644 --- a/static.el +++ b/static.el @@ -51,15 +51,18 @@ (list (quote quote) (, bodyform)) (,@ (mapcar (if var - (lambda (h) - (` ((, (car h)) - (list (quote funcall) - (lambda ((, var)) (,@ (cdr h))) - (list (quote quote) (, var)))))) - (lambda (h) - (` ((, (car h)) (quote (progn (,@ (cdr h)))))))) + (function + (lambda (h) + (` ((, (car h)) + (list (quote funcall) + (function (lambda ((, var)) (,@ (cdr h)))) + (list (quote quote) (, var))))))) + (function + (lambda (h) + (` ((, (car h)) (quote (progn (,@ (cdr h))))))))) handlers)))))) +(put 'static-defconst 'lisp-indent-function 'defun) (defmacro static-defconst (symbol initvalue &optional docstring) "`defconst' expression but INITVALUE is evaluated at compile-time. @@ -68,6 +71,14 @@ The variable SYMBOL can be referenced at either compile-time or run-time." (eval (` (defconst (, symbol) (quote (, value)) (, docstring)))) (` (defconst (, symbol) (quote (, value)) (, docstring))))) +(defmacro static-cond (&rest clauses) + "`cond' expression but the car of each clause is evaluated at compile-time." + (while (and clauses + (not (eval (car (car clauses))))) + (setq clauses (cdr clauses))) + (if clauses + (cons 'progn (cdr (car clauses))))) + ;;; @ end ;;;