1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

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

View File

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