From: Klaus Thoben <o22mailinglisten@imap.cc>
To: emacs-orgmode@gnu.org
Subject: Re: Checkboxes and state toggling
Date: Tue, 14 Jun 2011 22:22:59 +0200 [thread overview]
Message-ID: <87fwnc2me4.fsf@sputnik.localhost> (raw)
In-Reply-To: 6667.1307726209@alphaville.americas.hpqcorp.net
Nick Dokos <nicholas.dokos@hp.com> writes:
>
> #+begin_src emacs-lisp
> (add-to-list 'org-checkbox-statistics-hook (function ndk/checkbox-list-complete))
>
> (defun ndk/checkbox-list-complete ()
> (save-excursion
> (org-back-to-heading t)
> (let ((beg (point)) end)
> (end-of-line)
> (setq end (point))
> (goto-char beg)
> ;; check for the cookie: [100%] or [N/N]
> (if (re-search-forward "\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" end t)
> (if (match-end 1)
> (if (equal (match-string 1) "100%")
> ;; all done - do the state change
> (org-todo 'done))
> (if (and (> (match-end 2) (match-beginning 2))
> (equal (match-string 2) (match-string 3)))
> ;; all done - do the state change
> (org-todo 'done))))))))
> #+end_src
>
> Nick
Thanks, works like charm.
Klaus
prev parent reply other threads:[~2011-06-14 20:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-10 15:56 Checkboxes and state toggling Klaus Thoben
2011-06-10 17:16 ` Nick Dokos
2011-06-14 20:22 ` Klaus Thoben [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=87fwnc2me4.fsf@sputnik.localhost \
--to=o22mailinglisten@imap.cc \
--cc=emacs-orgmode@gnu.org \
/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).