[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals-release/org 8846ea7 1/2: element: Fix drawer parsing
From: |
ELPA Syncer |
Subject: |
[elpa] externals-release/org 8846ea7 1/2: element: Fix drawer parsing |
Date: |
Sun, 16 May 2021 04:57:12 -0400 (EDT) |
branch: externals-release/org
commit 8846ea71fadd085a9a5bf010ee4dd5b9ca5abe89
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
element: Fix drawer parsing
* lisp/org-element.el (org-element-drawer-parser): A single ":END:"
line should not be recognized as a drawer.
* testing/lisp/test-org-element.el (test-org-element/drawer-parser):
Add test.
Reported-by: Ihor Radchenko <yantar92@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00819.html>
---
lisp/org-element.el | 4 +++-
testing/lisp/test-org-element.el | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 1e5ca3e..0e01a0a 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -737,7 +737,9 @@ Return a list whose CAR is `drawer' and CDR is a plist
containing
Assume point is at beginning of drawer."
(let ((case-fold-search t))
- (if (not (save-excursion (re-search-forward "^[ \t]*:END:[ \t]*$" limit
t)))
+ (if (not (save-excursion
+ (goto-char (min limit (line-end-position)))
+ (re-search-forward "^[ \t]*:END:[ \t]*$" limit t)))
;; Incomplete drawer: parse it as a paragraph.
(org-element-paragraph-parser limit affiliated)
(save-excursion
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index bc21df3..93dd3b1 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -662,6 +662,9 @@ Some other text
(should-not
(org-test-with-temp-text ":TEST:"
(org-element-map (org-element-parse-buffer) 'drawer 'identity nil t)))
+ (should-not
+ (org-test-with-temp-text ":END:"
+ (org-element-map (org-element-parse-buffer) 'drawer 'identity nil t)))
;; Handle non-empty blank line at the end of buffer.
(should
(org-test-with-temp-text ":TEST:\nC\n:END:\n "