Commit 65a48be3a1ca9376bab15fa3c903f217402da356

Thomas de Grivel 2015-03-26T08:49:18

Make define-template-var use defparameter.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/template.lisp b/template.lisp
index 8bc276d..0627150 100644
--- a/template.lisp
+++ b/template.lisp
@@ -68,9 +68,13 @@
 	 ,@body))))
 
 (defmacro define-template-var (name &optional (value nil value-p) doc)
-  (if value-p
-      `(defvar ,(template-var-key name) ,value ,doc))
-      `(defvar ,(template-var-key name)))
+  (let ((var (template-var-key name)))
+    (if value-p
+	`(defparameter ,var ,value ,@(when doc `(,doc)))
+	(if doc
+	    `(progn (defvar ,var)
+		    (setf (documentation ',var t) ,doc))
+	    `(defvar ,var)))))
 
 ;;  Template reader