I'm trying to set the title of my emacs to how much work I've done in total.

I would like to get the time I've logged today programatically. (like when you open agenda and press 'R'). How do I do that?

I tried: (as per this link)

(format " Today's total: %s " (org-minutes-to-clocksum-string (org-clock-sum-today)))

But that returns 0:00

1 Answer 1


org-clock-sum-today only gets clock data from the buffer that Emacs is currently visiting, (set-buffer "test.org") in the linked example. I came up with this based on org-dblock-write:clocktable in org-clock, maybe it will work for you?

(defun eqyiel-org-clock-sum-today ()
  "Visit each file in `org-agenda-files' and return the total time of today's
clocked tasks in minutes."
  (let ((files (org-agenda-files))
        (total 0))
    (org-agenda-prepare-buffers files)
    (dolist (file files)
      (with-current-buffer (find-buffer-visiting file)
        (setq total (+ total (org-clock-sum-today)))))
  • This worked, thank you!. This lags a bit when it runs, so I made a little function that runs this in the background once a minute and caches it's output. Jul 21, 2015 at 0:42

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.