Function: org-element-class

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

Signature

(org-element-class DATUM &optional PARENT)

Documentation

Return class for ELEMENT, as a symbol.

Class is either element or object. Optional argument PARENT is the element or object containing DATUM. It defaults to the value of DATUM :parent property.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
(defsubst org-element-class (datum &optional parent)
  "Return class for ELEMENT, as a symbol.
Class is either `element' or `object'.  Optional argument PARENT
is the element or object containing DATUM.  It defaults to the
value of DATUM `:parent' property."
  (let ((type (org-element-type datum))
	(parent (or parent (org-element-property :parent datum))))
    (cond
     ;; Trivial cases.
     ((memq type org-element-all-objects) 'object)
     ((memq type org-element-all-elements) 'element)
     ;; Special cases.
     ((eq type 'org-data) 'element)
     ((eq type 'plain-text) 'object)
     ((not type) 'object)
     ;; Pseudo object or elements.  Make a guess about its class.
     ;; Basically a pseudo object is contained within another object,
     ;; a secondary string or a container element.
     ((not parent) 'element)
     (t
      (let ((parent-type (org-element-type parent)))
	(cond ((not parent-type) 'object)
	      ((memq parent-type org-element-object-containers) 'object)
	      ((org-element-secondary-p datum) 'object)
	      (t 'element)))))))