emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Checkbox difficulties


From: Dave Abrahams
Subject: Re: [O] Checkbox difficulties
Date: Tue, 11 Oct 2011 10:08:10 -0400
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (darwin)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]