Function: org-get-property-block
org-get-property-block is a byte-compiled function defined in
org.el.gz.
Signature
(org-get-property-block &optional BEG FORCE)
Documentation
Return the (beg . end) range of the body of the property drawer.
BEG is the beginning of the current subtree or the beginning of the document if before the first headline. If it is not given, it will be found. If the drawer does not exist, create it if FORCE is non-nil, or return nil.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-get-property-block (&optional beg force)
"Return the (beg . end) range of the body of the property drawer.
BEG is the beginning of the current subtree or the beginning of
the document if before the first headline. If it is not given,
it will be found. If the drawer does not exist, create it if
FORCE is non-nil, or return nil."
(org-with-wide-buffer
(let ((beg (cond (beg (goto-char beg))
((or (not (featurep 'org-inlinetask))
(org-inlinetask-in-task-p))
(org-back-to-heading-or-point-min t) (point))
(t (org-with-limited-levels
(org-back-to-heading-or-point-min t))
(point)))))
;; Move point to its position according to its positional rules.
(cond ((org-before-first-heading-p)
(while (and (org-at-comment-p) (bolp)) (forward-line)))
(t (forward-line)
(when (looking-at-p org-planning-line-re) (forward-line))))
(cond ((looking-at org-property-drawer-re)
(forward-line)
(cons (point) (progn (goto-char (match-end 0))
(line-beginning-position))))
(force
(goto-char beg)
(org-insert-property-drawer)
(let ((pos (save-excursion (re-search-forward org-property-drawer-re)
(line-beginning-position))))
(cons pos pos)))))))