emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* capture: create or append to existing heading, by date
@ 2015-10-01  7:32 Tamas Papp
  0 siblings, 0 replies; only message in thread
From: Tamas Papp @ 2015-10-01  7:32 UTC (permalink / raw)
  To: emacs-orgmode

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

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

only message in thread, other threads:[~2015-10-01  7:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01  7:32 capture: create or append to existing heading, by date Tamas Papp

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).