on Thu Oct 06 2011, Dave Abrahams <dave-AT-boostpro.com> wrote: > Here's a version that deals with at least one of your caveats: > > (defun ndk/checkbox-list-complete () > (save-excursion > (org-back-to-heading t) > (when looking-at (concat > "^\\*+[ \t]+" > org-todo-regexp ;; first match group here > "[ \t].*\\[" "\\(100%\\)\\|[0-9]+%" > "\\|" "\\([0-9]+\\)" "/" "\\([0-9]+\\)" "\\]") > (if (or (match-string 2) > (and (match-string 3) > (equal (match-string 3) (match-string 4)))) > (org-todo 'done) > (org-todo 'todo)))))
Whoops! Looks like I made some edits to that after my last test. Please try this one instead: --8<---------------cut here---------------start------------->8--- (defun dwa/checkbox-list-complete () (save-excursion (org-back-to-heading t) (when (looking-at (concat "^\\*+[ \t]+" org-todo-regexp ;; first match group here "[ \t].*\\[" "\\(?:" "\\(?2:100%\\)\\|[0-9]+%" "\\|" "\\(?3:[0-9]+\\)" "/" "\\(?4:[0-9]+\\)" "\\)" "\\]")) (if (or (match-string 2) (and (match-string 3) (equal (match-string 3) (match-string 4)))) (org-todo 'done) (org-todo 'todo))))) --8<---------------cut here---------------end--------------->8--- -- Dave Abrahams BoostPro Computing http://www.boostpro.com