3.4.6 Editing and Debugging formulas
You can edit individual formulas in the minibuffer or directly in the
field. Org-mode can also prepare a special buffer with all active
formulas of a table.
- C-c =
- C-u C-c =
- Edit the formula associated with the current column/field in the
minibuffer. See Column formulas and Field formulas.
- C-u C-u C-c =
- Re-insert the active formula (either a
field formula, or a column formula) into the current field, so that you
can edit it directly in the field. The advantage over editing in the
minibuffer is that you can use the command C-c ?.
- C-c ?
- While editing a formula in a table field, highlight the field(s)
referenced by the reference at the cursor position in the formula.
- C-c '
- Edit all formulas for the current table in a special buffer, where the
formulas will be displayed one per line.
While inside the special buffer, Org-mode will automatically highlight
any field or range reference at the cursor position. You may edit,
remove and add formulas, and use the following commands:
- C-c C-c
- Exit the buffer and store the modified formulas. With C-u prefix,
also apply the new formulas to the entire table.
- C-c C-q
- Exit the buffer without installing changes.
- <TAB>
- Pretty-print or indent lisp formula at point. When in a line containing
a lisp formula, format the formula according to Emacs Lisp rules.
Another <TAB> collapses the formula back again. In the open
formula, <TAB> re-indents just like in Emacs-lisp-mode.
- M-<TAB>
- Complete Lisp symbols, just like in Emacs-lisp-mode.
- S-<up>/<down>
- Move the reference line in the Org-mode buffer up and down. This is
important for highlighting the references of column formulas for
different rows.
- M-<up>/<down>
- Scroll the window displaying the table.
- C-c }
- Toggle the display of row and column numbers for a table, using
overlays. These are uptated each time the table is aligned, you can
force it with C-c C-c.
- C-c {
- Toggle the formula debugger on and off. See below.
Making a table field blank does not remove the formula associated with
the field, because that is stored in a different line (the `TBLFM'
line) - during the next recalculation the field will be filled again.
To remove a formula from a field, you have to give an empty reply when
prompted for the formula, or to edit the `#+TBLFM' line.
You may edit the `#+TBLFM' directly and re-apply the changed
equations with C-c C-c in that line, or with the normal
recalculation commands in the table.
Debugging formulas
When the evaluation of a formula leads to an error, the field content
becomes the string `#ERROR'. If you would like see what is going
on during variable substitution and calculation in order to find a bug,
turn on formula debugging in the Tbl menu and repeat the
calculation, for example by pressing C-c = <RET> in a field.
Detailed information will be displayed.