I am trying to use org-capture with a template that contains an org
table. The value of org-capture-templates is:

    (("b" "Blood pressure" entry
      (file "~/Org/bp.org")
      (file "~/Org/CaptureTemplates/b.org")
      :prepend t :immediate-finish t :post-process))

The file ~/Org/CaptureTemplates/b.org contains:

    * %U
    | Systolic     | Diastolic     | Pulse     |
    |--------------+---------------+-----------|
    | %^{Systolic} | %^{Diastolic} | %^{Pulse} |
    | %^{Systolic} | %^{Diastolic} | %^{Pulse} |
    | %^{Systolic} | %^{Diastolic} | %^{Pulse} |

(without the leading white space).

This works but the resulting table is not aligned, obviously I can
align it manually after capture but it would be nice if this could be
automated. I am unable to find any way to do this, am I missing
something or is this currently not possible?

A general solution to this could be to add a new :post-process
property to the template definition whose value should be a function
which is called immediately before
org-capture-before-finalize-hook. My problem would be solved with a
template like:

    (("b" "Blood pressure" entry
      (file "~/Org/bp.org")
      (file "~/Org/CaptureTemplates/b.org")
      :prepend t :immediate-finish t :post-process
      (lambda nil
        (goto-char
         (point-min))
        (search-forward "|-")
        (org-table-align))))

If there is any interest I can submit a patch.

Shaun Johnson.

Reply via email to