emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Capturing tables and a small proposal for a capture enhancement
@ 2011-10-05 18:55 Shaun Johnson
  0 siblings, 0 replies; only message in thread
From: Shaun Johnson @ 2011-10-05 18:55 UTC (permalink / raw)
  To: Org Mode

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-05 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-05 18:55 Capturing tables and a small proposal for a capture enhancement Shaun Johnson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).