summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-07-18 00:57:01 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2011-07-18 00:57:01 +0200
commitf7f2394448b033906a2699ed61f8cac855296fa7 (patch)
tree53b6d0333a8a97b2a303394706c070f0dad93068
parent054230b13828b2712865833498fc2ec6b42a85a1 (diff)
downloadorg-mode-f7f2394448b033906a2699ed61f8cac855296fa7.tar.gz
org-list: clean left-over markers
* lisp/org-list.el (org-list-send-item, org-list-struct-apply-struct, org-apply-on-list, org-toggle-checkbox): make markers point nowhere when they have become useless.
-rw-r--r--lisp/org-list.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 82eb0dd..120d18a 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -1454,8 +1454,7 @@ This function returns, destructively, the new list structure."
(+ end shift)))))))
moved-items))
(lambda (e1 e2) (< (car e1) (car e2))))))
- ;; 2. Eventually delete the extra copy of the item and clean
- ;; marker.
+ ;; 2. Eventually delete extra copy of the item and clean marker.
(prog1
(org-list-delete-item (marker-position item) struct)
(move-marker item nil)))
@@ -1756,7 +1755,7 @@ the structure to be applied. The function will only modify parts
of the list which have changed.
Initial position of cursor is restored after the changes."
- (let* ((pos (copy-marker (point)))
+ (let* ((origin (copy-marker (point)))
(inlinetask-re (and (featurep 'org-inlinetask)
(org-inlinetask-outline-regexp)))
(item-re (org-item-re))
@@ -1867,8 +1866,9 @@ Initial position of cursor is restored after the changes."
(unless (or (not cell) (equal cell (assq beg old-struct)))
(funcall modify-item beg))))
sliced-struct))
- ;; 4. Go back to initial position.
- (goto-char pos)))
+ ;; 4. Go back to initial position and clean marker.
+ (goto-char origin)
+ (move-marker origin nil)))
(defun org-list-write-struct (struct parents)
"Correct bullets, checkboxes and indentation in list at point.
@@ -1942,6 +1942,7 @@ beginning of the item."
(setq value (apply function value args)))
(nreverse all))
(goto-char item)
+ (move-marker item nil)
value))
(defun org-list-set-item-visibility (item struct view)
@@ -2289,11 +2290,9 @@ in subtree, ignoring drawers."
((equal "[X]" cbox) "[ ]")
(t "[X]"))))))
;; When an item is found within bounds, grab the full list at
- ;; point structure, then:
- ;; 1. set check-box of all its items within bounds to
- ;; REF-CHECKBOX;
- ;; 2. fix check-boxes of the whole list; 3. move point after the
- ;; list.
+ ;; point structure, then: (1) set check-box of all its items
+ ;; within bounds to REF-CHECKBOX, (2) fix check-boxes of the
+ ;; whole list, (3) move point after the list.
(goto-char lim-up)
(while (and (< (point) lim-down)
(org-list-search-forward (org-item-beginning-re)
@@ -2330,6 +2329,8 @@ in subtree, ignoring drawers."
"Checkboxes were removed due to unchecked box at line %d"
(org-current-line block-item))))
(goto-char bottom)
+ (move-marker lim-down nil)
+ (move-marker bottom nil)
(org-list-struct-apply-struct struct struct-copy)))))
(org-update-checkbox-count-maybe))