This is the setup I use for tracking time using the Pomodoro method. It requires org version >= 8.1.2.
I set the variables org-pomodoro-clock-out-sound and org-pomodoro-clock-in-sound to string file paths to “.au” files (Sun/NeXT audio data). In the org file where I am tracking my break time, I have the target “#<<pomodoro-break>>”. In the heading that I am timing, I set the property POMODORO to t. When I want to clock out of the pomodoro break, I simply clock into the task that I want to track.
(setq org-pomodoro-clock-out-sound "/home/devin/media/tones/chime.au"
org-pomodoro-clock-in-sound "/home/devin/media/tones/chime2.au"
org-pomodoro-break-file "/home/devin/datebook_PIM/datebook.org"
org-pomodoro-break-target "pomodoro-break")
If you do not specify a value for `org-pomodoro-break-file’, then a file in /tmp will be created. There is probably a better way to do this.
Finding the CLOCK time is done by searching the buffer with a regular expression.
`org-pomodoro-break’ is within the local variable scope of `org-clock-out’ when ran as a hook. The variable h that holds the hours gets overwritten, as does the total time in seconds. The variables `te’ and `ts’ could be used to recompute the time spent, but this would rely on those local variables not changing in the future.
According to the spec, the clock entries should follow this format:
clock format
CLOCK: TIMESTAMP DURATION
timestamp format
[DATE TIME REPEATER]--[DATE TIME REPEATER]
date format
YYYY-MM-DD DAYNAME
YYYY-MM-DD regex
[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}
“DAYNAME can contain any non-whitespace character besides +, -, ], >, a digit or \n.”
[^]-+>0-9\s\n]+
time format
H?H:MM
time regex
[0-9]\\{1,2\\}:[0-9]\\{2\\}
duration format
=> H+:MM
duration regex
=>\s+\\([0-9]+\\):\\([0-9][0-9]\\)
repeater is not used