Expand description
OA.16: clocked time, rolled up an outline — the report
scan-view-clockreport-mode renders over any scan view whose source
reports clock spans.
OA.16 — the clock report: clocked time, rolled up an outline.
Design: docs/dev/architecture/org-agenda.md §3. Slice plan:
org-agenda.md.
Emacs calls this a clocktable, and org-agenda-clockreport-mode puts one at
the top of the agenda. It answers “where did the week go”, which is a
different question from “what should I do next” — and that is why it is a
REPORT over the scan’s clock spans rather than a view of the agenda’s rows.
§Totals roll UP, and that is the whole shape
A span is filed against the headline it was clocked on. A report that listed only those would answer “which leaf did I clock” and never “how long did the project take”, which is the question anyone opens a clocktable for. So every span contributes to each of its ancestors as well as to itself.
[ClockSpan::outline] carries the whole chain precisely because of this: an
ancestor that logged no time of its own emits no span at all, so the chain
is the only way to name it. Rebuilding the tree from leaf names plus levels
would invent a parent for every orphan and mis-nest two projects that happen
to share a child name.
§Own time versus total time
Both are kept. total is what rolls up; own is what was clocked on that
headline itself. A tree showing only totals cannot distinguish a project
whose time is all in its children from one where half was spent on the
parent, and that difference is usually the interesting part of the report.
§The range is a display choice, not a scan
Spans are held per view unfiltered (see ScanViewState::clock), so
switching the report between a day, a week and a year filters data already
in hand. Re-walking the corpus to answer a question the data contains would
make a toggle cost a scan.
Structs§
- Clock
Report - A whole report: its rows in outline order, and the grand total.
- Clock
Report Element Ids - The interned ids the report’s rows paint with, captured once when the mode
activates so
collect()is an array-index resolve rather than a name lookup per row. - Clock
Report Provider - Renders a
ClockReportas virtual rows above line 0 of a scan view. - Clock
Report Registration - Removes the view’s report when the mode deactivates.
- Report
Row - One line of the report: a headline, its depth, and its two totals.
- Scan
View Clock Report Mode - OA.16 —
scan-view-clockreport-mode: the clock report, on a scan view.
Constants§
- ELEM_
CLOCKREPORT - Element name: the clock report’s own rows.
- ELEM_
CLOCKREPORT_ TOTAL - Element name: the report’s total line, which is the row people look at.
- TOGGLE_
ACTION - The keymap target
crfires.
Functions§
- build
- Build a report from
spans, keeping only those filed indays. - clock_
report_ provider_ id - The
ProviderIda view’s clock report registers under. - format_
minutes H:MM, org’s own clocktable spelling.- register_
clock_ report_ actions - Register the
crtarget. Unlikerefreshable-view-mode’s dead body, this one is the behaviour: the effect carries a mode name and nothing else, so there is no per-buffer state to read and no handler contribution to forget. - register_
clock_ report_ theme_ elements - Register the report’s two theme elements and return their interned ids.