diff --git a/lisp/org-element.el b/lisp/org-element.el index 27e9bdaca..275b013b7 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1284,10 +1284,9 @@ CONTENTS is the contents of the element." (throw 'exit (sort struct 'car-less-than-car)))))) ;; Skip blocks (any type) and drawers contents. (cond - ((and (looking-at "\\(?:[ \t]*\\)?#\\+BEGIN\\(:\\|_\\S-+\\)") + ((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)") (re-search-forward - (format "^[ \t]*#\\+END%s[ \t]*$" - (org-match-string-no-properties 1)) + (format "^[ \t]*#\\+END%s[ \t]*$" (match-string 1)) limit t))) ((and (looking-at org-drawer-regexp) (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))))