Function: org-habit-insert-consistency-graphs

org-habit-insert-consistency-graphs is a byte-compiled function defined in org-habit.el.gz.

Signature

(org-habit-insert-consistency-graphs &optional LINE)

Documentation

Insert consistency graph for any habitual tasks.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-habit.el.gz
(defun org-habit-insert-consistency-graphs (&optional line)
  "Insert consistency graph for any habitual tasks."
  (let ((inhibit-read-only t)
	(buffer-invisibility-spec '(org-link))
	(moment (time-subtract nil (* 3600 org-extend-today-until))))
    (save-excursion
      (goto-char (if line (line-beginning-position) (point-min)))
      (while (not (eobp))
	(let ((habit (get-text-property (point) 'org-habit-p))
              (invisible-prop (get-text-property (point) 'invisible)))
	  (when habit
	    (move-to-column org-habit-graph-column t)
	    (delete-char (min (+ 1 org-habit-preceding-days
				 org-habit-following-days)
			      (- (line-end-position) (point))))
	    (insert-before-markers
	     (org-habit-build-graph
	      habit
	      (time-subtract moment (days-to-time org-habit-preceding-days))
	      moment
	      (time-add moment (days-to-time org-habit-following-days))))
            ;; Inherit invisible state of hidden entries.
            (when invisible-prop
              (put-text-property
               (- (point) org-habit-graph-column) (point)
               'invisible invisible-prop))))
	(forward-line)))))