More small fixes on `C-u C-c C-c' and checkboxes.
authorBastien Guerry <bzg@altern.org>
Sat, 31 Dec 2011 17:20:30 +0000 (18:20 +0100)
committerBastien Guerry <bzg@altern.org>
Tue, 3 Jan 2012 08:19:46 +0000 (09:19 +0100)
* org.el (org-ctrl-c-ctrl-c): Preserve symmetry when adding
and removing checkboxes with `C-u C-c C-c' on the first item
of a list.  Also, don't reinitialize checkboxes that are
already ticked.

Thanks to Nicolas Goaziou for these fixes.

lisp/org.el

index af1c4a5..6598994 100644 (file)
@@ -18330,7 +18330,7 @@ This command does many different things, depending on context:
                        ((equal arg '(4)) nil)
                        ((equal "[X]" cbox) "[ ]")
                        (t "[X]"))))
-         (if firstp
+         (if (and firstp arg)
              ;; If at first item of sub-list, remove check-box from
              ;; every item at the same level.
              (mapc
@@ -18367,7 +18367,9 @@ This command does many different things, depending on context:
              ;; If at first item of sub-list, add check-box to every
              ;; item at the same level.
              (mapc
-              (lambda (pos) (org-list-set-checkbox pos new-struct "[ ]"))
+              (lambda (pos)
+                (unless (org-list-get-checkbox pos new-struct)
+                  (org-list-set-checkbox pos new-struct "[ ]")))
               (org-list-get-all-items
                (point-at-bol) new-struct (org-list-prevs-alist new-struct)))
            (org-list-set-checkbox (point-at-bol) new-struct "[ ]")))