On this page:
quote-syntax

3.21 Syntax Quoting: quote-syntax

syntax

(quote-syntax datum)

(quote-syntax datum #:local)
Similar to quote, but produces a syntax object that preserves the lexical information and source-location information attached to datum at expansion time.

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.

Unlike syntax (#'), quote-syntax does not substitute pattern variables bound by with-syntax, syntax-parse, or syntax-case.

Examples:
> (syntax? (quote-syntax x))

#t

> (quote-syntax (1 2 3))

#<syntax:eval:76:0 (1 2 3)>

> (with-syntax ([a #'5])
    (quote-syntax (a b c)))

#<syntax:eval:77:0 (a b c)>

> (free-identifier=? (let ([x 1]) (quote-syntax x))
                     (quote-syntax x))

#t

> (free-identifier=? (let ([x 1]) (quote-syntax x #:local))
                     (quote-syntax x))

#f

Changed in version 6.3 of package base: Added scope pruning and support for #:local.