X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=static.el;fp=static.el;h=e7cb5cd5f1558c28cace596d5ddb2f0a9d38ff77;hb=25b3b26447dafb5377b06a7d615e221448838cfe;hp=34d6f1beca3d79c206431c48f58e3ce928971e5e;hpb=4b7036b54447261fc50f06e02a72d8eb7ba6d524;p=elisp%2Fapel.git diff --git a/static.el b/static.el index 34d6f1b..e7cb5cd 100644 --- a/static.el +++ b/static.el @@ -29,38 +29,39 @@ "Like `if', but evaluate COND at compile time." (if (eval cond) then - (` (progn (,@ else))))) + `(progn ,@ else))) (put 'static-when 'lisp-indent-function 1) (defmacro static-when (cond &rest body) "Like `when', but evaluate COND at compile time." (if (eval cond) - (` (progn (,@ body))))) + `(progn ,@ body))) (put 'static-unless 'lisp-indent-function 1) (defmacro static-unless (cond &rest body) "Like `unless', but evaluate COND at compile time." (if (eval cond) nil - (` (progn (,@ body))))) + `(progn ,@ body))) (put 'static-condition-case 'lisp-indent-function 2) (defmacro static-condition-case (var bodyform &rest handlers) "Like `condition-case', but evaluate BODYFORM at compile time." - (eval (` (condition-case (, var) - (list (quote quote) (, bodyform)) - (,@ (mapcar - (if var - (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)))))) + (eval `(condition-case ,var + (list (quote quote) ,bodyform) + ,@ + (mapcar + (if var + (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) @@ -68,8 +69,8 @@ The variable SYMBOL can be referred at both compile time and run time." (let ((value (eval initvalue))) - (eval (` (defconst (, symbol) (quote (, value)) (, docstring)))) - (` (defconst (, symbol) (quote (, value)) (, docstring))))) + (eval `(defconst ,symbol (quote ,value) ,docstring)) + `(defconst ,symbol (quote ,value) ,docstring))) (defmacro static-cond (&rest clauses) "Like `cond', but evaluate CONDITION part of each clause at compile time."