From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Dave Abrahams <dave@boostpro.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: Feature-request: `org-after-checkbox-statistics-hook' [7.7 (release_7.7.370.g8e44ba)]
Date: Mon, 03 Oct 2011 00:15:24 +0200 [thread overview]
Message-ID: <87lit3jb0j.fsf@gmail.com> (raw)
In-Reply-To: <m239fbywgh.fsf@pluto.luannocracy.com> (Dave Abrahams's message of "Sun, 02 Oct 2011 16:23:10 -0400")
Dave Abrahams <dave@boostpro.com> writes:
> I was using checkboxes for a group of subtasks, and was surprised when
> the following (which I lifted from the manual) wasn't causing the parent
> item to be marked DONE upon checking the last box.
>
> (defun dwa/org-summary-todo (n-done n-not-done)
> "Switch entry to DONE when all subentries are done, to TODO otherwise."
> (let (org-log-done org-log-states) ; turn off logging
> (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
> (add-hook 'org-after-todo-statistics-hook 'dwa/org-summary-todo)
>
> So I set some debugger breakpoints and realized that code wasn't even
> getting called. There's a completely separate wad of code in org-list
> that handles checkbox statistics. So naturally, there's a hook, which I
> added my TODO->DONE function to:
>
> (add-hook 'org-checkbox-statistics-hook 'dwa/org-summary-todo)
>
> But `org-checkbox-statistics-hook' is a list of nullary functions, so of
> course this broke since my function expects N-DONE and N-NOT-DONE. I
> looked around for an easy way to determine N-DONE and N-NOT-DONE but it
> doesn't seem to exist; it's buried in the logic of
> org-update-checkbox-count... I think. What I need is a hook that acts
> like org-after-todo-statistics-hook, but for checkboxes.
You just have to search for "[ ]" or "[-]" in the current section. If
there is none, and there is at least one "[X]", you can mark your task
as done.
Isn't is sufficient for your task?
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2011-10-02 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 20:23 Bug: Feature-request: `org-after-checkbox-statistics-hook' [7.7 (release_7.7.370.g8e44ba)] Dave Abrahams
2011-10-02 22:15 ` Nicolas Goaziou [this message]
2011-10-03 13:53 ` Dave Abrahams
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lit3jb0j.fsf@gmail.com \
--to=n.goaziou@gmail.com \
--cc=dave@boostpro.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.