From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: automatically mark DONE when all sub checkboxes are checked Date: Fri, 10 Feb 2012 15:13:36 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvxmk-0005SH-Qg for emacs-orgmode@gnu.org; Fri, 10 Feb 2012 16:13:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rvxmj-0007fK-Cw for emacs-orgmode@gnu.org; Fri, 10 Feb 2012 16:13:38 -0500 Received: from mail-bk0-f41.google.com ([209.85.214.41]:42378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvxmj-0007fC-2w for emacs-orgmode@gnu.org; Fri, 10 Feb 2012 16:13:37 -0500 Received: by bkty12 with SMTP id y12so444776bkt.0 for ; Fri, 10 Feb 2012 13:13:36 -0800 (PST) In-Reply-To: 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: Peter Salazar Cc: emacs-orgmode@gnu.org On Fri, Feb 10, 2012 at 3:06 PM, Peter Salazar wrot= e: > 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=C2=A0http://orgmode.org/worg/org-faq.html, I f= ound 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." > I don't get any error, but it doesn't work. Also, the example in worg had an extra parenthesis at the end of it... not sure if that's goofing it up. I don't know lisp, so I just deleted one of the last parentheses and loading my .emacs stopped complaining. Not sure if that last trailing one was the offender or not. In any case, this is not working for me on an up to date org install (pulled yesterday). John > 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 () > =C2=A0 (save-excursion > =C2=A0 =C2=A0 (org-back-to-heading t) > =C2=A0 =C2=A0 (let ((beg (point)) end) > =C2=A0 =C2=A0 =C2=A0 (end-of-line) > =C2=A0 =C2=A0 =C2=A0 (setq end (point)) > =C2=A0 =C2=A0 =C2=A0 (goto-char beg) > =C2=A0 =C2=A0 =C2=A0 (if (re-search-forward > "\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" end t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (match-end 1) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (equal (match= -string 1) "100%") > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; = all done - do the state change > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or= g-todo 'done) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-todo = 'todo)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (and (> (match-end 2= ) (match-beginning 2)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(equal (match-string 2) (match-string 3))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-todo = 'done) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-todo 'todo))= )))))) > > > > P.S. Not sure if it's relevant, but I'm on OSX using Aquamacs 2.4.