Skip to main content

with_let

Function with_let 

Source
pub fn with_let<R>(
    cs: &Token,
    target: &Token,
    body: impl FnOnce() -> Result<R>,
) -> Result<R>
Expand description

Let macro setter Run body with cs temporarily \let to target (local scope), then restore cs’s prior meaning — the {\let\cs\target …} idiom of latex.ltx (\protected@edef’s \let\protect\@unexpandable@protect, :1442) without a save-stack group, for a reader that must not open one. The prior meaning is restored whether or not body fails. A cs with no meaning is restored to none.