The variable org-clock-modeline-total gives me several options for what time to show in the modeline, but they limited to time clocked into the current task. I would like to show the total time clock into all tasks in a particular subtree. Is that possible?


The org-mode function org-clock-sum-today comes pretty close to doing what you want; I found it while digging around in org-clock.el One option would be to write a wrapper function around that, then add the wrapper function to your mode line. For example:

(defun saintaardvark-org-clock-todays-total ()
  "Display total minutes clocked into org-mode for today."
    (set-buffer "test.org")
    (format " Today's total: %s " (org-minutes-to-clocksum-string (org-clock-sum-today)))))

After that, you can customize mode-line-format and insert something like this:


On my machine, that gives me a mode line like this:

Mode line showing "Total Time"

There are a couple things to note about this:

  • The documentation for the :eval form says "Make sure this evaluation cannot load any files, as doing so could cause infinite recursion." I presume this means it shouldn't load any other elisp files, and that a save-excursion is okay...but I could be wrong about this.

  • This does not turn off org-mode's own mode display.

  • You might want to suggest this feature (showing today's total) as an enhancement to the org-mode project.

  • This function assumes that everything is in one org file.

  • Up until relatively recently, I think there was a bug in org-clock-sum-today; it takes headline-filter as an argument (which would allow you to get total time by subtree), but did not actually use it. This appears to be fixed in HEAD in the Git repo, but is not in the latest released version (8.2.10).

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.