Function: org-element--cache-shift-positions
org-element--cache-shift-positions is a byte-compiled function defined
in org-element.el.gz.
Signature
(org-element--cache-shift-positions ELEMENT OFFSET &optional PROPS)
Documentation
Shift ELEMENT properties relative to buffer positions by OFFSET.
Properties containing buffer positions are :begin, :end,
:contents-begin, :contents-end and :structure. When
optional argument PROPS is a list of keywords, only shift
properties provided in that list.
Properties are modified by side-effect.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defsubst org-element--cache-shift-positions (element offset &optional props)
"Shift ELEMENT properties relative to buffer positions by OFFSET.
Properties containing buffer positions are `:begin', `:end',
`:contents-begin', `:contents-end' and `:structure'. When
optional argument PROPS is a list of keywords, only shift
properties provided in that list.
Properties are modified by side-effect."
(let ((properties (nth 1 element)))
;; Shift `:structure' property for the first plain list only: it
;; is the only one that really matters and it prevents from
;; shifting it more than once.
(when (and (or (not props) (memq :structure props))
(eq (org-element-type element) 'plain-list)
(not (eq (org-element-type (plist-get properties :parent)) 'item)))
(dolist (item (plist-get properties :structure))
(cl-incf (car item) offset)
(cl-incf (nth 6 item) offset)))
(dolist (key '( :begin :contents-begin :contents-end :end
:post-affiliated :robust-begin :robust-end))
(let ((value (and (or (not props) (memq key props))
(plist-get properties key))))
(and value (plist-put properties key (+ offset value)))))))