* poe.el (require): Update `current-load-list'.
[elisp/apel.git] / static.el
index a47eb05..b64440d 100644 (file)
--- a/static.el
+++ b/static.el
               (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))))))
 
-(defmacro static-defconst (symbol initvalue docstring)
+(put 'static-defconst 'lisp-indent-function 'defun)
+(defmacro static-defconst (symbol initvalue &optional docstring)
   "`defconst' expression but INITVALUE is evaluated at compile-time.
 
 The variable SYMBOL can be referenced at either compile-time or run-time."
@@ -68,10 +71,19 @@ 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
 ;;;
 
-(provide 'static)
+(require 'product)
+(product-provide (provide 'static) (require 'apel-ver))
 
 ;;; static.el ends here