[Top][All Lists]

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

[PATCH] org-element--current-element: Fix #+BEGIN$ parsed as special blo

From: Ihor Radchenko
Subject: [PATCH] org-element--current-element: Fix #+BEGIN$ parsed as special block
Date: Sun, 26 Dec 2021 22:50:47 +0800

Robert Nikander <robert.nikander@icloud.com> writes:

> Hitting TAB on the BEGIN line does nothing. But if I add a blank line before 
> it, then hitting TAB hides and shows the block. Is that a bug? Or am I doing 
> it wrong? Seems like it should work without the blank line.
> * Test
> Some text
> #+BEGIN 
> Hide this
> #+END
> M-x org-version => 9.5.1.

This last case is actually a bug. As Tomas pointed, Org blocks have
slightly different syntax: either #+begin_something or #+begin:
typeofblock. The fact that you can fold the #+BEGIN..#+END in your
second case should not happen.

The fix is attached.

Let me know if I miss something about special block parsing.


>From 289afdb9672eadaea119ebb2b0deecff4db3aa89 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sun, 26 Dec 2021 22:45:36 +0800
Subject: [PATCH] org-element--current-element: Fix #+BEGIN$ parsed as special

* lisp/org-element.el (org-element--current-element): Use
`org-element-dynamic-block-open-re' to match blocks.

Reported in Ycay4s3iAdEGSwgt@tuxteam.de/T/#t">https://list.orgmode.org/Ycay4s3iAdEGSwgt@tuxteam.de/T/#t
 lisp/org-element.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index eac39d429..ce251da38 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4266,7 +4266,7 @@ (defun org-element--current-element (limit &optional 
granularity mode structure
                    ((looking-at "CALL:")
                     (org-element-babel-call-parser limit affiliated))
-                   ((looking-at "BEGIN:? ")
+                   ((looking-at org-element-dynamic-block-open-re)
                     (org-element-dynamic-block-parser limit affiliated))
                    ((looking-at "\\S-+:")

reply via email to

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