emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Shaun Johnson <shaun@slugfest.demon.co.uk>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Capturing tables and a small proposal for a capture enhancement
Date: Wed, 05 Oct 2011 19:55:51 +0100	[thread overview]
Message-ID: <4E8CA837.7020908@slugfest.demon.co.uk> (raw)

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	other threads:[~2011-10-05 18:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8CA837.7020908@slugfest.demon.co.uk \
    --to=shaun@slugfest.demon.co.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).