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: Thu, 06 Oct 2011 17:25:02 -0400
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (darwin)

on Mon Oct 03 2011, Nick Dokos <nicholas.dokos-AT-hp.com> wrote:

> Dave Abrahams <address@hidden> wrote:
>
>> 
>> on Mon Oct 03 2011, Nick Dokos <nicholas.dokos-AT-hp.com> wrote:
>> 
>> > Dave Abrahams <address@hidden> wrote:
>> >
>> >> Wow, that's awesome... we're *so* close... but how do I get it to
>> >> automatically mark the item DONE when the last box is checked?
>> >> 
>> >
>> > Take a look at
>> >
>> >      http://thread.gmane.org/gmane.emacs.orgmode/42715/focus=42721
>> 
>> Works!  Oh-so-awesome!  Shouldn't these capabilities be built-in and
>> shipped as first class Org features?
>> 
>
> Well, if the function can be made to work completely generally, maybe:
> as it stands, it is more a proof-of-concept than a complete solution.
>
> I added an entry in the FAQ on Worg about this - I figured this is the
> second time the question has been asked on the list: ergo it's a FAQ ;-)
>
>    http://orgmode.org/worg/org-faq.html#sec-9-7
>
> You might want to read the entry: it includes a slightly revised function
> but it also includes a couple of caveats that explain why I think it's
> not a complete solution:

Thanks!  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)))))

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



reply via email to

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