mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-22 07:09:47 +00:00
org-element-paragraph-parser: Fix edge case; fix tests
* lisp/org-element.el (org-element-paragraph-parser): Fix edge case when 🔚 is in the middle of a paragraph. * testing/lisp/test-org-element.el (test-org-element/paragraph-parser): Fix point position in the tests. Add test case for ending lines of incomplete blocks/drawers. Remove test for incomplete dynamic blocks - they are keywords. Reported-by: Tom Alexander <tom@fizz.buzz> Link: https://orgmode.org/list/87o7hiwzma.fsf@localhost
This commit is contained in:
parent
38dd882685
commit
61c235b778
@ -2870,6 +2870,7 @@ Assume point is at the beginning of the paragraph."
|
||||
(progn (forward-line 0) t))))
|
||||
((looking-at-p org-element-drawer-re)
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(re-search-forward "^[ \t]*:END:[ \t]*$" limit t)))
|
||||
((looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)")
|
||||
(save-excursion
|
||||
|
@ -2629,30 +2629,34 @@ e^{i\\pi}+1=0
|
||||
(org-element-map (org-element-parse-buffer) 'paragraph 'identity)))
|
||||
;; Include incomplete-drawers.
|
||||
(should
|
||||
(org-test-with-temp-text ":TEST:\nParagraph"
|
||||
(org-test-with-temp-text "<point>:TEST:\nParagraph"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
(should
|
||||
(org-test-with-temp-text "<point>foo\n:end:\nbar"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
;; Include incomplete blocks.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nParagraph"
|
||||
(org-test-with-temp-text "<point>#+BEGIN_CENTER\nParagraph"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
;; Include incomplete dynamic blocks.
|
||||
(should
|
||||
(org-test-with-temp-text "#+BEGIN: \n<point>Paragraph"
|
||||
(org-test-with-temp-text "<point>foo\n#+END_CENTER\nbar"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
;; Include incomplete latex environments.
|
||||
(should
|
||||
(org-test-with-temp-text "\begin{equation}\nParagraph"
|
||||
(org-test-with-temp-text "<point>\begin{equation}\nParagraph"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
(should
|
||||
(org-test-with-temp-text "Paragraph\n\begin{equation}"
|
||||
(org-test-with-temp-text "<point>Paragraph\n\begin{equation}"
|
||||
(let ((elem (org-element-at-point)))
|
||||
(and (eq (org-element-type elem) 'paragraph)
|
||||
(= (point-max) (org-element-property :end elem))))))
|
||||
|
Loading…
Reference in New Issue
Block a user