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: Tue, 11 Oct 2011 10:08:10 -0400	[thread overview]
Message-ID: <m2obxnzkmt.fsf@pluto.luannocracy.com> (raw)
In-Reply-To: <m2hb3lizip.fsf@pluto.luannocracy.com> (Dave Abrahams's message of "Thu, 06 Oct 2011 17:25:02 -0400")


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	other threads:[~2011-10-11 14:08 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
2011-10-11 14:08             ` Dave Abrahams [this message]

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=m2obxnzkmt.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).