0

When I create a clocktable without using :step, like the block given below, the table generated has a #+CAPTION:, that is exactly what I want. Example:

#+BEGIN: clocktable :scope agenda-with-archives :block 2021-W31 :maxlevel 3 :hidefiles t :fileskip0 t :narrow 72! :match "-personal" :match "-nolog"
#+CAPTION: Clock summary at [2021-08-04 Wed 09:12], for week 2021-W31.
| Headline                                         |    Time |      |      |
|--------------------------------------------------+---------+------+------|
| *Total time*                                     |   *xxx* |      |      |
|--------------------------------------------------+---------+------+------|
| xxxx                                             |    xxxx |      |      |
| \_  xxxxxxxxxxxxxx                               |         | xxxx |      |
| \_    xxxxxxxxxxxxxxxxx                          |         |      | xxxx |
| \_    xxxxxxxxxxxxxxxxx                          |         |      | xxxx |
|--------------------------------------------------+---------+------+------|
| xxxxx                                            |    xxxx |      |      |
| \_  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |         | xxxx |      |
|--------------------------------------------------+---------+------+------|
| ...                                              |    .... |      |      |
| \_  LFA                                          |         | .... |      |
| \_    Tarefas                                    |         |      | .... |
#+END:

But when I give a :step, the many tables generated do not have captions, instead they have a simple line of text before the tables. Example:

#+BEGIN: clocktable :scope agenda-with-archives :block 2021-W31 :maxlevel 4 :hidefiles t :fileskip0 t :narrow 75! :step day :match "-personal" :match "-nolog"

Daily report: [2021-08-02 Mon]
| Headline                                           |    Time |      |      |      |
|----------------------------------------------------+---------+------+------+------|
| *Total time*                                       | *xx:xx* |      |      |      |
|----------------------------------------------------+---------+------+------+------|
| 2021                                               |   xx:xx |      |      |      |
| \_  2021-08 August                                 |         |      | x:xx |      |
| \_    2021-08-02 Monday                            |         |      | x:xx |      |
| \_      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |         |      |      | x:xx |
| \_      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx     |         |      |      | x:xx |
|----------------------------------------------------+---------+------+------+------|
| ...                                                |    .... |      |      |      |

Daily report: [2021-08-03 Tue]
| Headline                                           |    Time |      |      |      |
|----------------------------------------------------+---------+------+------+------|
| *Total time*                                       | *xx:xx* |      |      |      |
|----------------------------------------------------+---------+------+------+------|
| 2021                                               |    x:xx |      |      |      |
| \_  2021-08 August                                 |         | x:xx |      |      |
| \_    2021-08-03 Tuesday                           |         |      | x:xx |      |
| \_      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   |         |      |      | x:xx |
| \_      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx             |         |      |      | x:xx |
| \_      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |         |      |      | x:xx |
|----------------------------------------------------+---------+------+------+------|
| 2021i                                              |    x:xx |      |      |      |

Daily report: [2021-08-04 Wed]
| Headline                                           | Time   |      |      |      |
|----------------------------------------------------+--------+------+------+------|
| *Total time*                                       | *x:xx* |      |      |      |
|----------------------------------------------------+--------+------+------+------|
| 2021                                               | x:xx   |      |      |      |
| \_  2021-08 August                                 |        | x:xx |      |      |
| \_    2021-08-04 Wednesday                         |        |      | x:xx |      |
| \_      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |        |      |      | x:xx |

Daily report: [2021-08-05 Thu]
| Headline     | Time   |
|--------------+--------|
| *Total time* | *0:00* |

Daily report: [2021-08-06 Fri]
| Headline     | Time   |
|--------------+--------|
| *Total time* | *0:00* |

Daily report: [2021-08-07 Sat]
| Headline     | Time   |
|--------------+--------|
| *Total time* | *0:00* |

Daily report: [2021-08-08 Sun]
| Headline     | Time   |
|--------------+--------|
| *Total time* | *0:00* |
#+END:

Is there a way to may the clocktable generate #+CAPTION:s for the tables when I use :step?

Sorry if this is in the documentation, but I could not find it.

Thanks.

4
  • 1
    This is done by the function org-clocktable-steps in file org-clock.el, in the definition of the variable step-header - see the code here. The variable is used here.There is no provision for making the strings into captions: you will have to override that function with your own, almost identical function that does (insert "\n" "#+CAPTION: " step-header ...) instead.
    – NickD
    Aug 5, 2021 at 3:32
  • @NickD, I did as you instructed. Created a function called my-clocktable-steps-with-captions that is identical to org-clocktable-steps except for the (insert "\n" "#+CAPTION: " step-header ...) part, and in my Emacs configuration file I did (setq org-clocktable-steps #'my-clocktable-steps-with-caption). The the result (the clocktables generated) remain the same. Do you have any idea of what am I missing?
    – Jeff
    Aug 5, 2021 at 14:15
  • 1
    Yes - setq will not work to set the function cell of a symbol: you need fset for that - do C-h i g (elisp)Function cells for details.. But for now, the easiest thing to do is to name your function org-clocktable-steps: it will completely override the original. If you don't like it, delete it from your init file (if that's how you got it into the system in the first place - if you just evaluated it in the *scratch* buffer or in an elisp buffer, you don't have to do anything special). Then restart emacs: that will install the standard function.
    – NickD
    Aug 5, 2021 at 16:26
  • @NikD, thanks! Using fset solved the problem. The function is working as intended now.
    – Jeff
    Aug 6, 2021 at 21:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.