Function: org-element--next-mode

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

Signature

(org-element--next-mode MODE TYPE PARENT?)

Documentation

Return next mode according to current one.

MODE is a symbol representing the expectation about the next element or object. Meaningful values are first-section, item, node-property, planning, property-drawer, section, table-row, top-comment, and nil.

TYPE is the type of the current element or object.

If PARENT? is non-nil, assume the next element or object will be located inside the current one.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;; The following functions are internal parts of the parser.
;;
;; The first one, `org-element--parse-elements' acts at the element's
;; level.
;;
;; The second one, `org-element--parse-objects' applies on all objects
;; of a paragraph or a secondary string.  It calls
;; `org-element--object-lex' to find the next object in the current
;; container.

(defsubst org-element--next-mode (mode type parent?)
  "Return next mode according to current one.

MODE is a symbol representing the expectation about the next
element or object.  Meaningful values are `first-section',
`item', `node-property', `planning', `property-drawer',
`section', `table-row', `top-comment', and nil.

TYPE is the type of the current element or object.

If PARENT? is non-nil, assume the next element or object will be
located inside the current one."
  (if parent?
      (pcase type
	(`headline 'section)
	((and (guard (eq mode 'first-section)) `section) 'top-comment)
        ((and (guard (eq mode 'org-data)) `org-data) 'first-section)
        ((and (guard (not mode)) `org-data) 'first-section)
	(`inlinetask 'planning)
	(`plain-list 'item)
	(`property-drawer 'node-property)
	(`section 'planning)
	(`table 'table-row))
    (pcase mode
      (`item 'item)
      (`node-property 'node-property)
      ((and `planning (guard (eq type 'planning))) 'property-drawer)
      (`table-row 'table-row)
      ((and `top-comment (guard (eq type 'comment))) 'property-drawer))))