Преглед изворни кода

Checkboxes: Fix toggling of all checkboxes below a headline.

Using `C-c C-x C-b' in a headline now again toggles all checkboxes
below hat headline.  This feature got lost during a recent overhaul of
this function.

Reported by Chris Randle.
Carsten Dominik пре 16 година
родитељ
комит
98e1c8dbc3
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7 2
      lisp/org-list.el

+ 7 - 2
lisp/org-list.el

@@ -253,7 +253,9 @@ Return t when things worked, nil when we are not in an item."
 With prefix arg TOGGLE-PRESENCE, add or remove checkboxes.
 When there is an active region, toggle status or presence of the checkbox
 in the first line, and make every item in the region have the same
-status or precence, respectively."
+status or precence, respectively.
+If the cursor is in a headline, apply this to all checkbox items in the
+text below the heading."
   (interactive "P")
   (catch 'exit
     (let (beg end status first-present first-status)
@@ -286,7 +288,10 @@ status or precence, respectively."
       (save-excursion
 	(goto-char beg)
 	(setq first-present (org-at-item-checkbox-p)
-	      first-status (and first-present (equal (match-string 0) "[X]")))
+	      first-status
+	      (save-excursion
+		(and (re-search-forward "[ \t]\\(\\[[ X]\\]\\)" end t)
+		     (equal (match-string 1) "[X]"))))
 	(while (< (point) end)
 	  (if toggle-presence
 	      (cond