0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-20 16:26:29 +00:00

org-element: Fix cache bug

* lisp/org-element.el (org-element--cache-sync): Properly remove from
  cache last element in a plain list when blank lines at the end of
  that list are modified.
This commit is contained in:
Nicolas Goaziou 2013-11-15 23:46:45 +01:00
parent 91c1718519
commit 73d60606bd

View file

@ -5038,22 +5038,21 @@ removed from the cache."
;; Preserve any element ending before BEG. If it ;; Preserve any element ending before BEG. If it
;; overlaps the BEG-END area, remove it. ;; overlaps the BEG-END area, remove it.
(t (t
(when (let ((element (car value))) (let ((element (car value)))
(or (>= (org-element-property :end element) beg) (if (>= (org-element-property :end element) beg)
;; Special case: footnote definitions and (remhash key org-element--cache)
;; plain lists can end with blank lines. ;; Special case: footnote definitions and plain
;; Modifying those can also alter last ;; lists can end with blank lines. Modifying
;; element inside. We must therefore ;; those can also alter last element inside. We
;; remove these elements from cache. ;; must therefore remove them from cache.
(let ((parent (let ((parent (org-element-property :parent element)))
(org-element-property :parent element))) (when (and parent (eq (org-element-type parent) 'item))
(and (memq (org-element-type parent) (setq parent (org-element-property :parent parent)))
'(footnote-definition plain-list)) (when (and parent
(>= (org-element-property :end parent) beg) (>= (org-element-property :end parent) beg)
(= (org-element-property :contents-end (= (org-element-property :contents-end parent)
parent) (org-element-property :end element)))
(org-element-property :end element)))))) (remhash key org-element--cache))))))))
(remhash key org-element--cache)))))
org-element--cache) org-element--cache)
;; Signal cache as up-to-date. ;; Signal cache as up-to-date.
(org-element--cache-cancel-changes)))))) (org-element--cache-cancel-changes))))))