From mboxrd@z Thu Jan 1 00:00:00 1970 From: Klaus Thoben Subject: Re: Checkboxes and state toggling Date: Tue, 14 Jun 2011 22:22:59 +0200 Message-ID: <87fwnc2me4.fsf@sputnik.localhost> References: <87r5718ytv.fsf@sputnik.localhost> <6667.1307726209@alphaville.americas.hpqcorp.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWa8k-0002W8-AA for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 16:23:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWa8i-0005zx-UJ for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 16:23:10 -0400 Received: from lo.gmane.org ([80.91.229.12]:53644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWa8i-0005zp-L4 for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 16:23:08 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QWa8d-0002T7-5I for emacs-orgmode@gnu.org; Tue, 14 Jun 2011 22:23:03 +0200 Received: from 227.193.116.85.in-addr.arpa.manitu.net ([85.116.193.227]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2011 22:23:03 +0200 Received: from o22mailinglisten by 227.193.116.85.in-addr.arpa.manitu.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2011 22:23:03 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nick Dokos 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