1

Simply put, I have clocktables such as the following:

 #+BEGIN: clocktable :block today :scope tree2 :maxlevel 15 :properties ("Effort") :compact t
 #+CAPTION: Clock summary at [2018-06-29 Fri 17:53], for Friday, June 29, 2018.
 | Effort | Headline                      |   Time |
 |--------+-------------------------------+--------|
 |        | *Total time*                  | *0:19* |
 |--------+-------------------------------+--------|
 |        | \_  Org                       |   0:19 |
 |        | \_    Fix problems            |   0:19 |
 |   4:00 | \_      Refactor tagged trees |   0:19 |
 |   3:00 | \_        Sample tree         |   0:05 |
 #+END:

What I'd like is for the Effort column to be beside Time so that I can more easily compare the times. How do I achieve this?

2

The order of table columns is hard-coded into the formatter org-clocktable-write-default. You can set this formatter with the argument :formatter in the clocktable header. But org-clocktable-write-default is quite a monster so you rather re-use it in your own formatter. Furthermore it directly writes out the table text. You cannot manipulate table data in elisp form but you must use functions for manipulations of the table text:-(.

I give you here an example of a customized formatter for a clocktable. It is very specific to the header arguments used by you. But it is also short and quite self-descriptive. So it should quite easy to adapt it to any special case at hand.

(defun my-clocktable-write (&rest args)
  "Custom clocktable writer.
Uses the default writer but shifts the first column right."
  (apply #'org-clocktable-write-default args)
  (save-excursion
    (forward-char) ;; move into the first table field
    (org-table-move-column-right)))

There follows an application example which roughly reproduces your clocktable.

* Org
** Fix Problems 
*** Refactor tagged trees 
:PROPERTIES:
:EFFORT:   4:00
:END:
:LOGBOOK:
CLOCK: [2018-06-30 Sat 00:05]--[2018-06-30 Sat 00:19] =>  0:01
:END:
#+PROPERTY: Effort 1:00
**** Sample tree 
:PROPERTIES:
:EFFORT:   3:00
:END:
:LOGBOOK:
CLOCK: [2018-06-30 Sat 00:00]--[2018-06-30 Sat 00:05] =>  1:00
:END:

* clock table
#+BEGIN: clocktable :block today :maxlevel 15 :properties ("Effort") :compact t :formatter my-clocktable-write
#+CAPTION: Clock summary at [2018-06-30 Sat 01:18], for Saturday, June 30, 2018.
| Headline                    | Effort |   Time |
|-----------------------------+--------+--------|
| *Total time*                |        | *0:19* |
|-----------------------------+--------+--------|
| Org                         |        |   0:19 |
| \_  Fix Problems            |        |   0:19 |
| \_    Refactor tagged trees |   4:00 |   0:19 |
| \_      Sample tree         |   3:00 |   0:05 |
#+END:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.