Skip to main content

rebind_let_copies

Function rebind_let_copies 

Source
pub fn rebind_let_copies(cs: &Token, new: &Stored) -> usize
Expand description

Re-point every \let copy of cs’s current definition — any other meaning bound to that very definition (the same Rc: taken while it was in force, and not redefined since) — to new. Each binding is replaced in place, so a copy keeps its scope: a local copy stays local, and one a group shadows is new again when the group ends. Returns how many bindings were re-pointed; cs itself is left to the caller, which installs new for it. For a definition TeX treats as fixed before any code runs but installed late here: the job’s \jobname (core_interface::install_jobname).

The walk over the meaning table is bounded by the definition’s holders. Each holder besides cs’s own binding and this lookup may be a copy, so a definition nobody else holds needs no walk (no preload ran before the job), and the walk stops once as many copies as holders are found. A holder outside the table (a snapshot) leaves the bound loose, never short.