![]() |
Macros and environment variables | ![]() |
The main key-combinations that you should know to write style files are the following (see
progs/source/source-kbd.scm
for the complete list):
creates a new assignment. The first argument is a new command name and the second argument an expression.
permits to locally change one or more environment variables. With statements are of the form \(\langle x_1 |a_1 | \cdots |x_n |a_n |b \rangle\), where the \(x_i\) are the names of the variables, the \(a_i\) their local values, and \(b\) the text on which the local environment applies.
creates a macro. Arguments to the macro can be inserted using ⌃→ and ⌃←.
creates a macro with a variable number of arguments (xmacro).
get the value of a macro argument.
get the value of an environment variable.
applies a macro to zero or more arguments (compound).
specifies logical properties of tags (drd-props).
the evaluation control primitives quasi, quasiquote, unquote, quote and eval.
More precisely, when evaluating a macro application \(\langle a|x_1 | \cdots |x_n \rangle\) created by ⌘⌃IC, the following action is undertaken:
If \(a\) is not a string nor a macro, then \(a\) is evaluated once. This results either in a macro name or a macro expression \(f\).
If we obtain a macro name, then we replace \(f\) by the value of the environment variable \(f\). If, after this, \(f\) is still not a macro expression, then we return \(f\).
Let \(y_1, \ldots, y_n\) be the arguments of \(f\) and \(b\) its body (superfluous arguments are discarded; missing arguments take the value uninit). Then we substitute \(x_i\) for each \(y_i\) in \(b\) and return the evaluated result.