branch: externals/org commit e5e7ae36cf75c1f7242827d59b4d2d1c35ea4023 Author: Ihor Radchenko <yanta...@gmail.com> Commit: Ihor Radchenko <yanta...@gmail.com>
org-element--current-element: Fix #+BEGIN$ parsed as special block * lisp/org-element.el (org-element--current-element): Use `org-element-dynamic-block-open-re' to match blocks. * testing/lisp/test-org-element.el (test-org-element/paragraph-parser): Fix test relying on previous incorrect behaviour. Empty #+BEGIN: should be parsed as a keyword. Reported in https://list.orgmode.org/ycay4s3iadegs...@tuxteam.de/T/#t --- lisp/org-element.el | 4 +++- testing/lisp/test-org-element.el | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 6a5cfea1a4..0d1595d528 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4268,7 +4268,9 @@ element it has to parse." ((looking-at "CALL:") (beginning-of-line) (org-element-babel-call-parser limit affiliated)) - ((looking-at "BEGIN:? ") + ((save-excursion + (beginning-of-line) + (looking-at org-element-dynamic-block-open-re)) (beginning-of-line) (org-element-dynamic-block-parser limit affiliated)) ((looking-at "\\S-+:") diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 8c6fccb605..36ddc20d7a 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -2126,7 +2126,7 @@ e^{i\\pi}+1=0 (= (point-max) (org-element-property :end elem)))))) ;; Include incomplete dynamic blocks. (should - (org-test-with-temp-text "#+BEGIN: \nParagraph" + (org-test-with-temp-text "#+BEGIN: \n<point>Paragraph" (let ((elem (org-element-at-point))) (and (eq (org-element-type elem) 'paragraph) (= (point-max) (org-element-property :end elem))))))