From: Tamas Papp <tkpapp@gmail.com>
To: emacs-orgmode@gnu.org
Subject: capture: create or append to existing heading, by date
Date: Thu, 01 Oct 2015 09:32:31 +0200 [thread overview]
Message-ID: <878u7nyrg0.fsf@tamas.ihs.ac.at> (raw)
Hi,
I am tracking calories using tables like this:
--8<---------------cut here---------------start------------->8---
** [2015-10-01 Thu]
| | food | quantity | kcal/unit | kcal |
|---+----------------------+----------+-----------+-------|
| | | | <r> | |
| # | pepper_bell | 100 | 57/100 | 57.0 |
| # | cheese_Old_Amsterdam | 20 | 429/100 | 85.8 |
| # | mustard | 15 | 105/100 | 15.8 |
| # | egg | 3 | 88 | 264.0 |
| # | chocolate_dark | 10 | 550/100 | 55.0 |
|---+----------------------+----------+-----------+-------|
| # | | | <r> | 477.6 |
#+TBLFM: $4='(diet-lookup-calories $2)::$5=$3*$4;%0.1f::@>$5=vsum(@<<<..@>>)
--8<---------------cut here---------------end--------------->8---
(diet-lookup-calories is a function that looks up calories from another
table).
I need help with the following: the tables are organized daily, with
dates in the headings as above. I would like to have a capture process
where
1. if there is no table for today, create it, capture,
2. if there is a table for today, take me there and capture.
Currently I have implemented 1. with the org-capture-template
--8<---------------cut here---------------start------------->8---
("f" "food diary" entry (file+olp "~/org/calories.org" "diary")
"* %u
| | food | quantity | kcal/unit | kcal |
|---+------+-----------+-------------+-------|
| | | | <r> | |
| # | | | | |
|---+------+-----------+-------------+-------|
| # | | | <r> | |
#+TBLFM: $4='(diet-lookup-calories $2)::$5=$3*$4;%0.1f::@>$5=vsum(@<<<..@>>)
")
--8<---------------cut here---------------end--------------->8---
but it would be great if I had an automated process where tables are
created for the first capture of the day, then appended to after.
Thanks,
Tamas
reply other threads:[~2015-10-01 7:32 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=878u7nyrg0.fsf@tamas.ihs.ac.at \
--to=tkpapp@gmail.com \
--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).