manpagez: man pages & more
info m4
Home | html | info | man

File: m4.info,  Node: Undefine,  Next: Defn,  Prev: Pseudo Arguments,  Up: Definitions

5.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.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.