Function: org-element-put-property
org-element-put-property is a byte-compiled function defined in
org-element-ast.el.gz.
Signature
(org-element-put-property NODE PROPERTY VALUE)
Documentation
In NODE, set PROPERTY to VALUE.
Return modified NODE.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-element-ast.el.gz
(define-inline org-element-put-property (node property value)
"In NODE, set PROPERTY to VALUE.
Return modified NODE."
(let ((idx (and (inline-const-p property)
(org-element--property-idx property))))
(if idx
(inline-letevals (node value)
(inline-quote
(if (org-element-type-p ,node 'plain-text)
;; Special case: Do not use parray for plain-text.
(org-add-props ,node nil ,property ,value)
(let ((parray
(or (org-element--parray ,node)
(org-element--put-parray ,node))))
(when parray (aset parray ,idx ,value))
,node))))
(inline-letevals (node property value)
(inline-quote
(let ((idx (org-element--property-idx ,property)))
(if (and idx (not (org-element-type-p ,node 'plain-text)))
(when-let*
((parray
(or (org-element--parray ,node)
(org-element--put-parray ,node))))
(aset parray idx ,value))
(pcase (org-element-type ,node)
(`nil nil)
(`plain-text
(org-add-props ,node nil ,property ,value))
(_
;; Note that `plist-put' adds new elements at the end,
;; thus keeping `:standard-properties' as the first element.
(setcar (cdr ,node) (plist-put (nth 1 ,node) ,property ,value)))))
,node))))))