A macro is any programming or user interface in which an action can be associated with a sequence set of actions that are to be performed in its place. The term can be applied to two distinct categories of things:

user-interface macros allow the user to bind a short sequence of inputs to a longer action, like the @ command in vi.

  • link examples of such in Tk code?

syntactic macros occur in the source code of a program, and are used to transform or generate program code. This is the facility Lisp uses to generate new control structures. In Tcl this is accomplished prior to evaluation using commands such as string map and regsub. During evaluation, commands such as uplevel, upvar, and tailcall accomplish similar functionality.

Template and Macro processing: An inventory of Tcl (syntactic) macro systems and other text-substitution