Thank you very much Carsten.
It works very well.
One small detail is that if the cursor is not in the table when it is
refiled then the formula is not evaluated. Most users probably won't
notice
this and it also works correctly when using the :immediate-finish
option.
However, when testing this I think I found a bug that could be
serious. Suppose that I set a template to ask me the name and price
for a
new item in the table. If I type C-g at this point the capture
buffer will
be buried but still available and unsaved. If the user saves this
file the
original file will be overwritten and all information there will be
lost. Even if the user realises the mistake just after saving the file
there is no way to recover the content because all undo information
was
lost.