Function: org-clock-display

org-clock-display is an autoloaded, interactive and byte-compiled function defined in org-clock.el.gz.

Signature

(org-clock-display &optional ARG)

Documentation

Show subtree times in the entire buffer.

By default, show the total time for the range defined in org-clock-display-default-range. With C-u (universal-argument) prefix, show the total time for today instead.

With C-u (universal-argument) C-u (universal-argument) prefix, use a custom range, entered at prompt.

With C-u (universal-argument) C-u (universal-argument) C-u (universal-argument) prefix, display the total time in the echo area.

Use M-x org-clock-remove-overlays (org-clock-remove-overlays) to remove the subtree times.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
;;;###autoload
(defun org-clock-display (&optional arg)
  "Show subtree times in the entire buffer.

By default, show the total time for the range defined in
`org-clock-display-default-range'.  With `\\[universal-argument]' \
prefix, show
the total time for today instead.

With `\\[universal-argument] \\[universal-argument]' prefix, \
use a custom range, entered at prompt.

With `\\[universal-argument] \ \\[universal-argument] \
\\[universal-argument]' prefix, display the total time in the
echo area.

Use `\\[org-clock-remove-overlays]' to remove the subtree times."
  (interactive "P")
  (org-clock-remove-overlays)
  (let* ((todayp (equal arg '(4)))
	 (customp (member arg '((16) today yesterday
				thisweek lastweek thismonth
				lastmonth thisyear lastyear
				untilnow interactive)))
	 (prop (cond ((not arg) :org-clock-minutes-default)
		     (todayp :org-clock-minutes-today)
		     (customp :org-clock-minutes-custom)
		     (t :org-clock-minutes))))
    (cond ((not arg) (org-clock-sum-custom
		      nil org-clock-display-default-range prop))
	  (todayp (org-clock-sum-today))
	  (customp (org-clock-sum-custom nil arg))
	  (t (org-clock-sum)))
    (unless (equal arg '(64))
      (save-excursion
	(goto-char (point-min))
	(let ((p nil))
	  (while (or (and (equal (setq p (point)) (point-min))
			  (get-text-property p prop))
		     (setq p (next-single-property-change (point) prop)))
	    (goto-char p)
	    (let ((time (get-text-property p prop)))
	      (when time (org-clock-put-overlay time)))))
	;; Arrange to remove the overlays upon next change.
	(when org-remove-highlights-with-change
	  (add-hook 'before-change-functions #'org-clock-remove-overlays
		    nil 'local))))
    (let* ((h (/ org-clock-file-total-minutes 60))
	   (m (- org-clock-file-total-minutes (* 60 h))))
      (message (cond
		(todayp
		 "Total file time for today: %s (%d hours and %d minutes)")
		(customp
		 "Total file time (custom): %s (%d hours and %d minutes)")
		(t
		 "Total file time: %s (%d hours and %d minutes)"))
	       (org-duration-from-minutes org-clock-file-total-minutes)
	       h m))))