6

Org-mode's Clocktable reports show the task state "TODO/OPEN/DONE" at the beggining of the headline:

like so:

|          | TODO  Bug 459487 - [GTK] Replace...     | 7:38    |      |
|          | OPEN Black Pomodoro App                 | 1:15    |      |

I want to remove these keywords as I don't want them in my weekly reports that I publish to our group.

I looked at the clock table reference but could not find a way to filter them out. Perhaps there is some way to write a filter-function. Would anyone be able to point me in the direction of how I could write this feature?

2
  • The function org-clock-get-table-data appears to do the meat of harvesting data from a table and placing it into a list. One could defadvice around that and edit the headlines that have ended up in the list. Commented Feb 16, 2015 at 21:02
  • sounds interesting. Do you happen to have a snippet that does something similar that I could base things off? Commented Feb 17, 2015 at 15:15

1 Answer 1

10

Clock tables support formatting options:

#+BEGIN: clocktable :formatter my-org-clocktable-notodo

#+END:

Here's a function which removes TODO and DONE keywords from headlines before handing the data off to the default formatting function:

(defun my-org-clocktable-notodo (ipos tables params)
  (cl-loop for tbl in tables
           for entries = (nth 2 tbl)
           do (cl-loop for entry in entries
                       for headline = (nth 1 entry)
                       do (setq headline (replace-regexp-in-string "TODO \\|DONE " "" headline))
                       do (setcar (nthcdr 1 entry) headline)))
  (org-clocktable-write-default ipos tables params))

Another option would be to advise `org-clocktable-write-default to have the keywords stripped from all clock tables.

This function would be smarter if it constructed the regexp of todo keywords dynamically according to those defined in the document. (maybe someone can add that)

2
  • Thank you so much for your code. This solves the problem perfectly. Btw, do you have any links to tutorials on how to write such formatting functions? Commented Feb 23, 2015 at 22:06
  • btw, I was wondering if you'd knew anything about clock-report categorizing as in: emacs.stackexchange.com/questions/9502/… Commented Feb 23, 2015 at 22:08

Your Answer

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

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