org-element-parse-buffer: Emphasize that current major mode should be org-mode

* lisp/org-element.el (org-element-parse-buffer): Update the docstring
making it more explicit that the function assumes buffer being in Org
mode.

Reported-by: Antonio Romano <n58r@pm.me>
Link: https://list.orgmode.org/orgmode/1b2b8c2791e628f6a41ef533e49a5ac9e3dee8a4.camel@pm.me/
This commit is contained in:
Ihor Radchenko 2024-10-26 19:31:27 +02:00
parent 49e0c4a74a
commit 377741dc5e
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 4 deletions

View File

@ -4937,10 +4937,13 @@ When PARSE is non-nil, values from keywords belonging to
;; parts of the parse tree.
(defun org-element-parse-buffer (&optional granularity visible-only keep-deferred)
"Recursively parse the buffer and return structure.
"Recursively parse the current Org mode buffer and return structure.
If narrowing is in effect, only parse the visible part of the
buffer.
This function assumes that current major mode is `org-mode'. When the
major mode is different, the behaviour is undefined.
Optional argument GRANULARITY determines the depth of the
recursion. It can be set to the following symbols:
@ -4979,9 +4982,7 @@ pattern (TYPE PROPERTIES CONTENTS), where :
The Org buffer has `org-data' as type and nil as properties.
`org-element-map' function can be used to find specific elements
or objects within the parse tree.
This function assumes that current major mode is `org-mode'."
or objects within the parse tree."
(save-excursion
(goto-char (point-min))
(let ((org-data (org-element-org-data-parser))