1: (defun org-element-parse-buffer (&optional granularity visible-only)
2: "Recursively parse the buffer and return structure.
3: If narrowing is in effect, only parse the visible part of the
6: Optional argument GRANULARITY determines the depth of the
7: recursion. It can be set to the following symbols:
9: `headline' Only parse headlines.
10: `greater-element' Don't recurse into greater elements except
11: headlines and sections. Thus, elements
12: parsed are the top-level ones.
13: `element' Parse everything but objects and plain text.
14: `object' Parse the complete buffer (default).
16: When VISIBLE-ONLY is non-nil, don't parse contents of hidden
19: An element or object is represented as a list with the
20: pattern (TYPE PROPERTIES CONTENTS), where :
22: TYPE is a symbol describing the element or object. See
23: `org-element-all-elements' and `org-element-all-objects' for an
24: exhaustive list of such symbols. One can retrieve it with
25: `org-element-type' function.
27: PROPERTIES is the list of attributes attached to the element or
28: object, as a plist. Although most of them are specific to the
29: element or object type, all types share `:begin', `:end',
30: `:post-blank' and `:parent' properties, which respectively
31: refer to buffer position where the element or object starts,
32: ends, the number of white spaces or blank lines after it, and
33: the element or object containing it. Properties values can be
34: obtained by using `org-element-property' function.
36: CONTENTS is a list of elements, objects or raw strings
37: contained in the current element or object, when applicable.
38: One can access them with `org-element-contents' function.
40: The Org buffer has `org-data' as type and nil as properties.
41: `org-element-map' function can be used to find specific elements
42: or objects within the parse tree.
44: This function assumes that current major mode is `org-mode'."
46: (goto-char (point-min))
49: (point-at-bol) (point-max)
52: 'first-section nil granularity visible-only (list 'org-data nil))))
日付: 2018-08-09 Thu 09:45
Created: 2018-12-14 Fri 21:04