From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Salazar Subject: automatically mark DONE when all sub checkboxes are checked Date: Fri, 10 Feb 2012 16:06:18 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e6de049004a44804b8a28046 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvxfh-0003kz-IR for emacs-orgmode@gnu.org; Fri, 10 Feb 2012 16:06:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rvxfg-0006QM-9p for emacs-orgmode@gnu.org; Fri, 10 Feb 2012 16:06:21 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:63696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvxfg-0006Q0-5Q for emacs-orgmode@gnu.org; Fri, 10 Feb 2012 16:06:20 -0500 Received: by wibhj13 with SMTP id hj13so2935531wib.0 for ; Fri, 10 Feb 2012 13:06:18 -0800 (PST) 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 --0016e6de049004a44804b8a28046 Content-Type: text/plain; charset=ISO-8859-1 Hello everyone! Org-mode is amazing. I've totally fallen in love with it. Glad to be joining the community. I'm trying to get org-mode to automatically mark DONE when all sub checkboxes are checked. On http://orgmode.org/worg/org-faq.html, I found a function that purports to do this. I pasted the function into my .emacs file, but now I'm getting an error message when I launch: "Symbol's value as variable is void: org-checkbox-statistics-hook." Any thoughts? Thanks in advance! ;; see http://thread.gmane.org/gmane.emacs.orgmode/42715 (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) (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) (org-todo 'todo)) (if (and (> (match-end 2) (match-beginning 2)) (equal (match-string 2) (match-string 3))) (org-todo 'done) (org-todo 'todo)))))))) P.S. Not sure if it's relevant, but I'm on OSX using Aquamacs 2.4. --0016e6de049004a44804b8a28046 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello everyone! Org-mode is amazing. I've totally fallen in love w= ith it. Glad to be joining the community.=A0

I'= ;m trying to get org-mode to automatically mark DONE when all sub checkboxe= s are checked. On=A0http:/= /orgmode.org/worg/org-faq.html, I found a function that purports to do = this.

I pasted the function into my .emacs file, but now I= 9;m getting an error message when I launch: "Symbol's value as var= iable is void: org-checkbox-statistics-hook."=A0

Any thoughts? Thanks in advance!=A0


(add-t= o-list 'org-checkbox-statistics-hook (function ndk/checkbox-list-comple= te))

(defun ndk/checkbox-list-complete ()
=A0 (sav= e-excursion
=A0 =A0 (org-back-to-heading t)
=A0 =A0 (le= t ((beg (point)) end)
=A0 =A0 =A0 (end-of-line)
=A0 =A0= =A0 (setq end (point))
=A0 =A0 =A0 (goto-char beg)
=A0 =A0 =A0 (if (re-search-forwa= rd "\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" end t)=
=A0 =A0 =A0 =A0 =A0 =A0 (if (match-end 1)
=A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 (if (equal (match-string 1) "100%")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; all done - do the state cha= nge
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-todo 'done)<= /div>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-todo 'todo))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 (if (and (> (match-end 2) (match-beginnin= g 2))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(equal (match-string 2)= (match-string 3)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-todo= 'done)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-todo 'todo))= ))))))



P.S. Not sure if it's relevant, but I'm on OSX using Aqu= amacs 2.4.
--0016e6de049004a44804b8a28046--