Function: org-element-adopt-elements

org-element-adopt-elements is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-adopt-elements PARENT &rest CHILDREN)

Documentation

Append elements to the contents of another element.

PARENT is an element or object. CHILDREN can be elements, objects, or a strings.

The function takes care of setting :parent property for CHILD. Return parent element.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defsubst org-element-adopt-elements (parent &rest children)
  "Append elements to the contents of another element.

PARENT is an element or object.  CHILDREN can be elements,
objects, or a strings.

The function takes care of setting `:parent' property for CHILD.
Return parent element."
  (declare (indent 1))
  (if (not children) parent
    ;; Link every child to PARENT. If PARENT is nil, it is a secondary
    ;; string: parent is the list itself.
    (dolist (child children)
      (when child
        (org-element-put-property child :parent (or parent children))))
    ;; Add CHILDREN at the end of PARENT contents.
    (when parent
      (apply #'org-element-set-contents
	     parent
	     (nconc (org-element-contents parent) children)))
    ;; Return modified PARENT element.
    (or parent children)))