3.21 Syntax Quoting: quote-syntax
When #:local is specified, then all scopes in the syntax object’s lexical information are preserved. When #:local is omitted, then the scope sets within datum are pruned to omit the scope for any binding form that appears between the quote-syntax form and the enclosing top-level context, module body, or phase level crossing, whichever is closer.
> (syntax? (quote-syntax x))
> (quote-syntax (1 2 3))
#<syntax:76:0 (1 2 3)>
> (with-syntax ([a #'5]) (quote-syntax (a b c)))
#<syntax:77:0 (a b c)>
> (free-identifier=? (let ([x 1]) (quote-syntax x)) (quote-syntax x))
> (free-identifier=? (let ([x 1]) (quote-syntax x #:local)) (quote-syntax x))
Changed in version 6.3 of package base: Added scope pruning and support for #:local.