emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 20162f5a5c 1/2: org-element-dynamic-block-open-re-n


From: ELPA Syncer
Subject: [elpa] externals/org 20162f5a5c 1/2: org-element-dynamic-block-open-re-nogroup: Demand block name
Date: Tue, 12 Sep 2023 06:58:31 -0400 (EDT)

branch: externals/org
commit 20162f5a5c93eed62620e04da92edceefd2445e2
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-element-dynamic-block-open-re-nogroup: Demand block name
    
    * lisp/org-element.el (org-element-dynamic-block-open-re-nogroup): Fix
    inconsistency with `org-element-dynamic-block-open-re' - block name is
    mandatory.
    *
    testing/lisp/test-org-element.el (test-org-element/dynamic-block-parser):
    Add test.
---
 lisp/org-element.el              | 2 +-
 testing/lisp/test-org-element.el | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index dd39c5092b..40bb294795 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -189,7 +189,7 @@ Parameters are in match group 2.")
 
 (defconst org-element-dynamic-block-open-re-nogroup
   (rx line-start (0+ (any ?\s ?\t))
-      "#+BEGIN:" (0+ (any ?\s ?\t)))
+      "#+BEGIN:" (0+ (any ?\s ?\t)) word)
   "Regexp matching the opening line of a dynamic block.")
 
 (defconst org-element-headline-re
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 8b3b5aebdd..3b11d496fb 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1282,7 +1282,11 @@ Some other text
   ;; Handle non-empty blank line at the end of buffer.
   (should
    (org-test-with-temp-text "#+BEGIN: myblock :param val1\nC\n#+END:\n  "
-     (= (org-element-property :end (org-element-at-point)) (point-max)))))
+     (= (org-element-property :end (org-element-at-point)) (point-max))))
+  ;; Block name is mandatory.
+  (should-not
+   (org-test-with-temp-text "#+BEGIN:\n\n#+END:\n"
+     (org-element-type-p (org-element-at-point) 'dynamic-block))))
 
 
 ;;;; Entity



reply via email to

[Prev in Thread] Current Thread [Next in Thread]