Function: org-indent-add-properties
org-indent-add-properties is a byte-compiled function defined in
org-indent.el.gz.
Signature
(org-indent-add-properties BEG END &optional DELAY)
Documentation
Add indentation properties between BEG and END.
When DELAY is non-nil, it must be a time value. In that case,
the process is asynchronous and can be interrupted, either by
user request, or after DELAY. This is done by throwing the
interrupt tag along with the buffer position where the process
stopped.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-indent.el.gz
(defun org-indent-add-properties (beg end &optional delay)
"Add indentation properties between BEG and END.
When DELAY is non-nil, it must be a time value. In that case,
the process is asynchronous and can be interrupted, either by
user request, or after DELAY. This is done by throwing the
`interrupt' tag along with the buffer position where the process
stopped."
(save-match-data
(org-with-wide-buffer
(goto-char beg)
(forward-line 0)
;; Initialize prefix at BEG, according to current entry's level.
(let* ((case-fold-search t)
(limited-re (org-get-limited-outline-regexp))
(level (or (org-current-level) 0))
(time-limit (and delay (time-add nil delay))))
;; For each line, set `line-prefix' and `wrap-prefix'
;; properties depending on the type of line (headline, inline
;; task, item or other).
(with-silent-modifications
(while (and (<= (point) end) (not (eobp)))
(cond
;; When in asynchronous mode, check if interrupt is
;; required.
((and delay (input-pending-p)) (throw 'interrupt (point)))
;; In asynchronous mode, take a break of
;; `org-indent-agent-resume-delay' every DELAY to avoid
;; blocking any other idle timer or process output.
((and delay (time-less-p time-limit nil))
(setq org-indent-agent-resume-timer
(run-with-idle-timer
(time-add (current-idle-time) org-indent-agent-resume-delay)
nil #'org-indent-initialize-agent))
(throw 'interrupt (point)))
;; Headline or inline task.
((looking-at org-outline-regexp)
(let* ((nstars (- (match-end 0) (match-beginning 0) 1))
(type (or (looking-at-p limited-re) 'inlinetask)))
(org-indent-set-line-properties nstars 0 type)
;; At an headline, define new value for LEVEL.
(unless (eq type 'inlinetask) (setq level nstars))))
;; List item: `wrap-prefix' is set where body starts.
((org-at-item-p)
(org-indent-set-line-properties
level (org-list-item-body-column (point))))
;; Regular line.
(t
(org-indent-set-line-properties
level
(current-indentation)
;; When adapt indentation is 'headline-data, use
;; `org-indent--heading-line-prefixes' for setting
;; headline data indentation.
(and (eq org-adapt-indentation 'headline-data)
(or (org-at-planning-p)
(org-at-clock-log-p)
(looking-at-p org-property-start-re)
(looking-at-p org-property-end-re)
(looking-at-p org-property-re))))))))))))