Skip to main content
3 of 6
added 59 characters in body
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63

For the sake of coping with implicit space when doing \let I suggest s.th. like this:

\def\redefine#1#2{% \expandafter\let\csname\string#1\endcsname= #1% \def#1{#2}% }% \def\exchange#1#2{#2#1}% \def\recover#1{% \expandafter\exchange\expandafter{\csname\string#1\endcsname}{\let#1= }% }% \def\foobar{foo} \foobar \redefine\foobar{bar} \foobar \recover\foobar \foobar \bye 

enter image description here

Alternatively just do some scoping via \begingroup..\endgroup or {..}:

\def\foobar{foo}% \foobar \begingroup \def\foobar{bar}% \foobar \endgroup \foobar {% \def\foobar{bar}% \foobar }% \foobar \bye 
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63