Browse Source

org-element: Fix cache corruption when moving list

* lisp/org-element.el (org-element--shift-positions): Fix cache
  corruption when moving list.
Nicolas Goaziou 11 years ago
parent
commit
91c1718519
1 changed files with 6 additions and 6 deletions
  1. 6 6
      lisp/org-element.el

+ 6 - 6
lisp/org-element.el

@@ -4819,12 +4819,12 @@ modified by side-effect.  Return modified element."
     ;; Shift :structure property for the first plain list only: it is
     ;; the only one that really matters and it prevents from shifting
     ;; it more than once.
-    (when (eq (car element) 'plain-list)
-      (let ((structure (plist-get properties :structure)))
-	(when (<= (plist-get properties :begin) (caar structure))
-	  (dolist (item structure)
-	    (incf (car item) offset)
-	    (incf (nth 6 item) offset)))))
+    (when (and (eq (org-element-type element) 'plain-list)
+	       (not (eq (org-element-type (plist-get properties :parent))
+			'item)))
+      (dolist (item (plist-get properties :structure))
+	(incf (car item) offset)
+	(incf (nth 6 item) offset)))
     (plist-put properties :begin (+ (plist-get properties :begin) offset))
     (plist-put properties :end (+ (plist-get properties :end) offset))
     (dolist (key '(:contents-begin :contents-end :post-affiliated))