Commit 74563d90 authored by Erik Huelsmann's avatar Erik Huelsmann

Macro hygene: use a generated (anonymous) symbol in macro expansion

The variable name 'next-hooks' potentially (theoretically)
clashes with variable names defined in the body of the expansion.

Don't clash by using an anonymous symbol.
parent af5c58aa
...@@ -83,12 +83,13 @@ ...@@ -83,12 +83,13 @@
a `call-next-hook` to its caller as it is the content a `call-next-hook` to its caller as it is the content
of the rendered page. of the rendered page.
" "
`(progn (let ((next-hooks-sym (gensym)))
(defun ,name (,@args next-hooks) `(progn
(flet ((call-next-hook (content context) (defun ,name (,@args ,next-hooks-sym)
(funcall (pop next-hooks) content context next-hooks))) (flet ((call-next-hook (content context)
,@body)) (funcall (pop ,next-hooks-sym) content context ,next-hooks-sym)))
(push (function ,name) *render-hooks*))) ,@body))
(push (function ,name) *render-hooks*))))
(defun render-page-with-hooks (content context) (defun render-page-with-hooks (content context)
(let ((hooks (reverse (cons #'(lambda (p c next-processors) (let ((hooks (reverse (cons #'(lambda (p c next-processors)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment