diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-01-30 13:39:40 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-02-18 12:45:12 +0100 |
commit | 69cc51fa43851dd6fcd856aea8e39805f46a26c1 (patch) | |
tree | 4874fc832763178aa93617f80153ca0a09b61b8a | |
parent | e5a61ab260281bc5c8e10896aca918b3bfb69f1b (diff) | |
download | org-mode-69cc51fa43851dd6fcd856aea8e39805f46a26c1.tar.gz |
C-c C-c also repairs ill-formed lists
* lisp/org-list.el (org-list-struct): mark items less indented than
top item of the list, so that they will be modified.
(org-list-struct-apply-struct): compare struct's indentation with
line's indentation instead of old-struct's. This is needed because
`org-list-struct' automatically fixes indentation so changes might not
be seen otherwise.
* lisp/org.el (org-ctrl-c-ctrl-c): small refactoring.
-rw-r--r-- | lisp/org-list.el | 10 | ||||
-rw-r--r-- | lisp/org.el | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index ab10b77..eec719d 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -800,8 +800,12 @@ Assume point is at an item." ;; indented. (let ((min-ind (nth 1 (car struct)))) (mapc (lambda (item) - (let ((ind (nth 1 item))) - (when (< ind min-ind) (setcar (cdr item) min-ind)))) + (let ((ind (nth 1 item)) + (bul (nth 2 item))) + (when (< ind min-ind) + (setcar (cdr item) min-ind) + ;; Modify bullet to be sure item will be modified + (setcar (nthcdr 2 item) (org-trim bul))))) struct)) ;; 4. Associate each item to its end pos. (org-list-struct-assoc-end struct end-lst) @@ -1616,7 +1620,7 @@ Initial position of cursor is restored after the changes." (lambda (item) (goto-char item) (let* ((new-ind (org-list-get-ind item struct)) - (old-ind (org-list-get-ind item old-struct)) + (old-ind (org-get-indentation)) (new-bul (org-list-bullet-string (org-list-get-bullet item struct))) (old-bul (org-list-get-bullet item old-struct)) diff --git a/lisp/org.el b/lisp/org.el index 23137ec..8ef3bf5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17429,7 +17429,7 @@ This command does many different things, depending on context: ;; Do checkbox related actions only if function was called with ;; an argument (let* ((struct (org-list-struct)) - (old-struct (mapcar (lambda (e) (copy-alist e)) struct)) + (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct))) (org-list-struct-fix-ind struct parents) |