emacs-orgmode
[Top][All Lists]
Advanced

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

[O] capture: create or append to existing heading, by date


From: Tamas Papp
Subject: [O] capture: create or append to existing heading, by date
Date: Thu, 01 Oct 2015 09:32:31 +0200
User-agent: mu4e 0.9.13; emacs 24.5.1

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 via email to

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