mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 09:02:52 +00:00
org-element: Fix post-blank shared between items
* lisp/org-element.el (org-element-item-parser): Do not parse beyond LIMIT - they may extend :post-blank beyond parent list contents. (org-element-plain-list-parser): Make sure that plain list always owns the trailing blank lines. (org-element-cache-version): Bump cache version. * testing/lisp/test-org-element.el (test-org-element/item-parser): Add test. Reported-by: Tom Alexander <tom@fizz.buzz> Link: https://orgmode.org/list/1c833eb8-c556-437b-ac5b-be360ebcc869@app.fastmail.com
This commit is contained in:
parent
80ae8462a6
commit
53c9d91d3c
|
@ -1518,8 +1518,8 @@ CONTENTS is the contents of inlinetask."
|
|||
|
||||
;;;; Item
|
||||
|
||||
(defun org-element-item-parser (_ struct &optional raw-secondary-p)
|
||||
"Parse an item.
|
||||
(defun org-element-item-parser (limit struct &optional raw-secondary-p)
|
||||
"Parse an item up to LIMIT.
|
||||
|
||||
STRUCT is the structure of the plain list.
|
||||
|
||||
|
@ -1545,7 +1545,8 @@ Assume point is at the beginning of the item."
|
|||
((equal "[X]" box) 'on)
|
||||
((equal "[-]" box) 'trans))))
|
||||
(end (progn (goto-char (nth 6 (assq (point) struct)))
|
||||
(if (bolp) (point) (line-beginning-position 2))))
|
||||
(min limit
|
||||
(if (bolp) (point) (line-beginning-position 2)))))
|
||||
(pre-blank 0)
|
||||
(contents-begin
|
||||
(progn
|
||||
|
@ -1760,6 +1761,9 @@ Assume point is at the beginning of the list."
|
|||
(= (nth 1 item) ind))
|
||||
(setq pos (nth 6 item)))
|
||||
pos))
|
||||
(contents-end (progn (goto-char contents-end)
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(if (bolp) (point) (line-beginning-position 2))))
|
||||
(end (progn (goto-char contents-end)
|
||||
(skip-chars-forward " \r\t\n" limit)
|
||||
(if (= (point) limit) limit (line-beginning-position)))))
|
||||
|
@ -5419,7 +5423,7 @@ indentation removed from its contents."
|
|||
(defvar org-element-cache-persistent t
|
||||
"Non-nil when cache should persist between Emacs sessions.")
|
||||
|
||||
(defconst org-element-cache-version "2.1"
|
||||
(defconst org-element-cache-version "2.2"
|
||||
"Version number for Org AST structure.
|
||||
Used to avoid loading obsolete AST representation when using
|
||||
`org-element-cache-persistent'.")
|
||||
|
|
|
@ -2110,6 +2110,10 @@ DEADLINE: <2012-03-29 thu.>"
|
|||
(should
|
||||
(= 0
|
||||
(org-test-with-temp-text "- A\n\n - B\n\n<point> - C\n\n End sub-list"
|
||||
(org-element-property :post-blank (org-element-at-point)))))
|
||||
(should
|
||||
(= 0
|
||||
(org-test-with-temp-text "1. foo\n 1. bar\n 2.<point> baz\n\n2. lorem\nipsum"
|
||||
(org-element-property :post-blank (org-element-at-point))))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue