emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Capturing tables and a small proposal for a capture enhancement


From: Shaun Johnson
Subject: [O] Capturing tables and a small proposal for a capture enhancement
Date: Wed, 05 Oct 2011 19:55:51 +0100
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

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

[Prev in Thread] Current Thread [Next in Thread]