emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dave Abrahams <dave@boostpro.com>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Checkbox difficulties
Date: Thu, 06 Oct 2011 17:25:02 -0400	[thread overview]
Message-ID: <m2hb3lizip.fsf@pluto.luannocracy.com> (raw)
In-Reply-To: <23215.1317681137@alphaville.americas.hpqcorp.net> (Nick Dokos's message of "Mon, 03 Oct 2011 18:32:17 -0400")


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

> Dave Abrahams <dave@boostpro.com> wrote:
>
>> 
>> on Mon Oct 03 2011, Nick Dokos <nicholas.dokos-AT-hp.com> wrote:
>> 
>> > Dave Abrahams <dave@boostpro.com> 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	other threads:[~2011-10-06 21:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 19:06 Checkbox difficulties Dave Abrahams
2011-10-02 19:11 ` John Hendy
2011-10-02 19:15 ` Nicolas Goaziou
2011-10-02 20:57   ` Dave Abrahams
2011-10-02 21:02     ` Dave Abrahams
2011-10-02 22:04       ` Nicolas Goaziou
2011-10-03  5:50     ` Nick Dokos
2011-10-03 14:50       ` Dave Abrahams
2011-10-03 14:55       ` Dave Abrahams
2011-10-03 22:32         ` Nick Dokos
2011-10-06 21:25           ` Dave Abrahams [this message]
2011-10-11 14:08             ` Dave Abrahams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2hb3lizip.fsf@pluto.luannocracy.com \
    --to=dave@boostpro.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).