org: Radio tables
A.6.1 Radio tables
------------------
To define the location of the target table, you first need to create two
lines that are comments in the current mode, but contain magic words
‘BEGIN/END RECEIVE ORGTBL’ for Orgtbl mode to find. Orgtbl mode will
insert the translated table between these lines, replacing whatever was
there before. For example in C mode where comments are between ‘/* ...
*/’:
/* BEGIN RECEIVE ORGTBL table_name */
/* END RECEIVE ORGTBL table_name */
Just above the source table, we put a special line that tells Orgtbl
mode how to translate this table and where to install it. For example:
#+ORGTBL: SEND table_name translation_function arguments...
‘table_name’ is the reference name for the table that is also used in
the receiver lines. ‘translation_function’ is the Lisp function that
does the translation. Furthermore, the line can contain a list of
arguments (alternating key and value) at the end. The arguments will be
passed as a property list to the translation function for
interpretation. A few standard parameters are already recognized and
acted upon before the translation function is called:
‘:skip N’
Skip the first N lines of the table. Hlines do count as separate
lines for this parameter!
‘:skipcols (n1 n2 ...)’
List of columns that should be skipped. If the table has a column
with calculation marks, that column is automatically discarded as
well. Please note that the translator function sees the table
_after_ the removal of these columns, the function never knows that
there have been additional columns.
‘:no-escape t’
When non-‘nil’, do not escape special characters ‘&%#_^’ when
exporting the table. The default value is ‘nil’.
The one problem remaining is how to keep the source table in the buffer
without disturbing the normal workings of the file, for example during
compilation of a C file or processing of a LaTeX file. There are a
number of different solutions:
• The table could be placed in a block comment if that is supported
by the language. For example, in C mode you could wrap the table
between ‘/*’ and ‘*/’ lines.
• Sometimes it is possible to put the table after some kind of END
statement, for example ‘\bye’ in TeX and ‘\end{document}’ in LaTeX.
• You can just comment the table line-by-line whenever you want to
process the file, and uncomment it whenever you need to edit the
table. This only sounds tedious—the command ‘M-x
orgtbl-toggle-comment RET’ makes this comment-toggling very easy,
in particular if you bind it to a key.