Previous: , Up: Referring to Format Tables   [Contents][Index]


4.2.2 Current Format Table

Unless otherwise specified, FoCus uses a so-called current format table every time it needs one. This table is stored in the global variable *format-table*, which you are free to use directly.

FoCus also provides a couple of macros to manipulate the current format table in a very idiomatic way.

Macro: with-format-table TABLE-OR-NAME &body BODY

Execute BODY with the current format table bound to TABLE-OR-NAME.

TABLE-OR-NAME is of course a table designator: either a table object directly, or the name of a previously registered table.

When the flv extension is available (see Optional Features) FoCus also defines a macro called in-format-table. You may check for the availability of this macro by testing the presence of the feature :net.didierverna.focus.flv.

Macro: in-format-table TABLE-OR-NAME

Set the current format table to TABLE-OR-NAME in the current file.

TABLE-OR-NAME is again a table designator: either a table object directly, or the name of a previously registered table.

This macro is meant to be used in a way similar to in-package or in-readtable. It actually works the same way and lets you write highliy idiomatic code like this:

(in-package      :my.library.name)
(in-format-table :my.library.name)

Remember however that there is a big difference between these two calls. In the case of in-package, the keyword is a string designator. Your package really is named "MY.LIBRARY.NAME". In the case of in-format-table, your table really is named after the symbol MY.LIBRARY.NAME interned into the KEYWORD package.

Finally, note that using in-format-table requires that the format table in question be available at compile-time (see Compile or Run Time).


Previous: , Up: Referring to Format Tables   [Contents][Index]