From c866dcc8e593da2fca2611b100b4ab3ea9641e03 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Sat, 16 Apr 2022 13:08:57 +0800 Subject: [PATCH] org-element-export-snippet-parser: Fix snippets without ending @@ * lisp/org-element.el (org-element-export-snippet-parser): Do not recognise snippets without closing @@ as empty "@@backend:" snippets. Example: @@html:fo aksjdaksjd ajs d askdjas aksj daj sao@@ Reported in https://github.com/lucasvreis/org-parser/blob/master/SPEC.org#export-snippets --- lisp/org-element.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 9db1406b3..661902e04 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -2980,8 +2980,9 @@ (defun org-element-export-snippet-parser () (when (and (looking-at "@@\\([-A-Za-z0-9]+\\):") (setq contents-end (save-match-data (goto-char (match-end 0)) - (re-search-forward "@@" nil t) - (match-beginning 0)))) + (when + (re-search-forward "@@" nil t) + (match-beginning 0))))) (let* ((begin (match-beginning 0)) (back-end (match-string-no-properties 1)) (value (buffer-substring-no-properties -- 2.35.1