2

Recently I upgraded my emacs from 24 to 25 and now when I do a org-clock-display command in one of my org files it only shows me the total for the current year, not previous years.

Is it possible to adjust the range in which org-clock-display will check?

2

EDIT: I've now tried org-mode 8.3.2. There org-mode-displayis rewritten. See the new documentation of org-mode-display. If you run org-mode-display with two prefix args then you can input the time range.

For the range you have the following choices (just try tab): "today" "yesterday" "thisweek" "lastweek" "thismonth" "lastmonth" "thisyear" "lastyear" "interactive".

You can customize the default range with the option org-clock-display-default-range. The original value of this option is thisyear which explains your results. If you set its value to untilnow you get the summation without lower bound.


The following text regards org-mode 8.2.X only.

Note at first that I have GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-11-10 with org-mode 8.2.10. There, I cannot reconstruct the effect that time is summed only over the current year.


Now, to your question:

Is it possible to adjust the range in which org-clock-display will check?

I found that (org-clock-sum) is hard-wired in (org-clock-display) without the optional tstart and tend arguments of org-clock-sum.

So, some hack is required to accept clock intervals in org-clock-display. The following new command org-clock-interval-display asks for a start and an end time for summing the time.

Note, the total-only option in org-clock-display is broken. So I did remove it in org-clock-interval-display. One can add it without problems via current-prefix-arg in the interactive-list in org-clock-interval-display if it is fixed in org-clock-display. But, before you do that you should rather issue a feature request for adding optional interactive tstart and tstop arguments to org-clock-display.

(defmacro with-current-fset (backup symbol function &rest body)
  "Save SYMBOL's function definition in BACKUP,
set it temporarily to FUNCTION, and execute BODY.
After the execution of BODY the function definition of SYMBOL is restored."
  (declare (debug (sexp sexp function-form body)) (indent 3))
  `(let ((,backup (symbol-function ',symbol)))
     (unwind-protect
     (progn
       (fset ',symbol ,function)
       ,@body)
       (fset ',symbol ,backup))))

(defun org-clock-interval-display (tstart tend)
  "Like `org-clock-display' but considers tstart and tstop for `org-clock-sum'."
  (interactive (list (org-read-date t t nil "Start time:")
             (org-read-date t t nil "Stop time:")))
  (with-current-fset --org-clock-sum org-clock-sum (lambda () (funcall --org-clock-sum tstart tend))
    (org-clock-display)))

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.