Next: , Previous: Pseudo Arguments, Up: Definitions


4.4 Deleting a macro

A macro definition can be removed with undefine:

— Builtin: undefine (name...)

For each argument, remove the macro name. The macro names must necessarily be quoted, since they will be expanded otherwise.

The expansion of undefine is void. The macro undefine is recognized only with parameters.

     foo bar blah
     =>foo bar blah
     define(`foo', `some')define(`bar', `other')define(`blah', `text')
     =>
     foo bar blah
     =>some other text
     undefine(`foo')
     =>
     foo bar blah
     =>foo other text
     undefine(`bar', `blah')
     =>
     foo bar blah
     =>foo bar blah

Undefining a macro inside that macro's expansion is safe; the macro still expands to the definition that was in effect at the `('.

     define(`f', ``$0':$1')
     =>
     f(f(f(undefine(`f')`hello world')))
     =>f:f:f:hello world
     f(`bye')
     =>f(bye)

It is not an error for name to have no macro definition. In that case, undefine does nothing.