I’m looking for a way to merge subtrees with duplicate structure into a single subtree, primarily for the purposes of clockreporting on time.
In my mind it would work like this
‘(org-merge-subtree-level 2) => determines how far down the tree to merge
org-merge-subtrees would match headlines down to the org-merge-subtree level, and if matched, content and further subtrees from matches would be merged into the first match. This could be done non-destructively or destructively (possibly
another configuration option to determine this)
* m1
** mm1
CLOCK: [2013-07-28 Mon 09:05]--[2013-07-28 Mon 09:30] => 0:25
mm1 content
** mm2
CLOCK: [2013-07-28 Mon 09:45]--[2013-07-28 Mon 10:13] => 0:28
mm2 content
* m1
CLOCK: [2013-07-28 Mon 09:30]--[2013-07-28 Mon 09:40] => 0:10
** mm2
CLOCK: [2013-07-28 Mon 09:40]--[2013-07-28 Mon 09:45] => 0:05
more mm2 content
** mm3
CLOCK: [2013-07-28 Mon 10:30]--[2013-07-28 Mon 11:30] => 1:00
mm3 content
(org-merge-subtrees) would produce a single tree:
* m1
CLOCK: [2013-07-28 Mon 09:30]--[2013-07-28 Mon 09:40] => 0:10
** mm1
CLOCK: [2013-07-28 Mon 09:05]--[2013-07-28 Mon 09:30] => 0:25
mm1 content
** mm2
CLOCK: [2013-07-28 Mon 09:45]--[2013-07-28 Mon 10:13] => 0:28
CLOCK: [2013-07-28 Mon 09:40]--[2013-07-28 Mon 09:45] => 0:05
mm2 content
more mm2 content
** mm3
CLOCK: [2013-07-28 Mon 10:30]--[2013-07-28 Mon 11:30] => 1:00
mm3 content
Drawers should merge, CLOCK notes stay with the CLOCK line, etc
Ideally this would operate across files into a temporary buffer or var as well
Motivation is primarily to facilitate clockreporting.
Example: I have a project, RA, with 3 files in it.
I use a standard structure in files, like this
* overview
project overview
* data files
** file 1
content
** file 2
*** TODO generate data
* SQL
** query 1
I’d like to be able to generate a clocktable at the project level with all time spent on eg data files grouped and summarized into one entry. Instead what I get is something that looks like this (using my example above)
#+BEGIN: clocktable :block lastyear :narrow 30 :scope file :tcolumns 2 :maxlevel 2
#+CAPTION: Clock summary at [2014-07-30 Wed 10:22], for the year 2013.
| <30> | | |
| Headline | Time | |
|--------------------------------+--------+------|
| *Total time* | *2:08* | |
|--------------------------------+--------+------|
| m1 | 0:53 | |
| \__ mm1 | | 0:25 |
| \__ mm2 | | 0:28 |
| m1 | 1:15 | |
| \__ mm2 | | 0:05 |
| \__ mm3 | | 1:00 |
#+END:
I guess this could operate either on the subtrees themselves, or maybe make clocktable smarter and have options to collapse tables like the above like this:
#+BEGIN: clocktable :block lastyear :narrow 30 :scope file :tcolumns 2 :maxlevel 2 :collapse 2
#+CAPTION: Clock summary at [2014-07-30 Wed 10:22], for the year 2013.
| <30> | | |
| Headline | Time | |
|--------------------------------+--------+------|
| *Total time* | *2:08* | |
|--------------------------------+--------+------|
| m1 | 2:08 | |
| \__ mm1 | | 0:25 |
| \__ mm2 | | 0:33 |
| \__ mm3 | | 1:00 |
#+END:
And also work at the file level, so if the 2 m1 trees came from separate files they would be combined.
Subhan
Subhan Michael Tindall
Program Analyst
– FamilyCare Health Plans
825 NE Multnomah St, Suite 1400; Portland OR 97232
Direct: 503-471-3127
Fax: 503-471-3177
Email:
subhant@familycareinc.org