Re: [Orgmode] checklist and org-after-todo-statistics-hook

2010-03-29 Thread Carsten Dominik


On Mar 25, 2010, at 7:14 PM, David Ellis wrote:

I have the following in my .emacs file to automatically update the  
todo state of a parent todo based on the number of completed children.


(defun org-summary-todo (n-done n-not-done)
  Switch entry to DONE when all subentries are done, to TODO  
otherwise.

  (this is an unquoted list)
  (let (org-log-done org-log-states)   ; turn off logging
(org-todo (if (= n-not-done 0)
  DONE
(if (= n-done 0) TODO STARTED)

(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

I have started using checklists and notices that this hook does not  
get called when the statistics cookie is updated.


For example, in the following, the parent todo state gets updated as  
the statistics cookie is updated:


* STARTED Project 1 [1/3]
** DONE task 1
** TODO task 2
** TODO task 3

In the following example, the statistics are updated but the hook is  
not called


* TODO Project 1 [1/3]
- [X] task 1
- [ ] task 2
- [ ] task 3

Is it possible to change it to call the hook for the second example?


Hi Dave, there is a separate for this situation:

org-checkbox-statistics-hook

HTH

- Carsten



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] checklist and org-after-todo-statistics-hook

2010-03-29 Thread Carsten Dominik


On Mar 25, 2010, at 7:14 PM, David Ellis wrote:

I have the following in my .emacs file to automatically update the  
todo state of a parent todo based on the number of completed children.


(defun org-summary-todo (n-done n-not-done)
 Switch entry to DONE when all subentries are done, to TODO  
otherwise.

 (this is an unquoted list)
 (let (org-log-done org-log-states)   ; turn off logging
   (org-todo (if (= n-not-done 0)
 DONE
   (if (= n-done 0) TODO STARTED)

(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

I have started using checklists and notices that this hook does not  
get called when the statistics cookie is updated.


For example, in the following, the parent todo state gets updated as  
the statistics cookie is updated:


* STARTED Project 1 [1/3]
** DONE task 1
** TODO task 2
** TODO task 3

In the following example, the statistics are updated but the hook is  
not called


* TODO Project 1 [1/3]
   - [X] task 1
   - [ ] task 2
   - [ ] task 3

Is it possible to change it to call the hook for the second example?


Hi Dave, there is a separate for this situation:

org-checkbox-statistics-hook

HTH

- Carsten



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] checklist and org-after-todo-statistics-hook

2010-03-25 Thread David Ellis
I have the following in my .emacs file to automatically update the todo
state of a parent todo based on the number of completed children.

(defun org-summary-todo (n-done n-not-done)
  Switch entry to DONE when all subentries are done, to TODO otherwise.
  (this is an unquoted list)
  (let (org-log-done org-log-states)   ; turn off logging
(org-todo (if (= n-not-done 0)
  DONE
(if (= n-done 0) TODO STARTED)

(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

I have started using checklists and notices that this hook does not get
called when the statistics cookie is updated.

For example, in the following, the parent todo state gets updated as the
statistics cookie is updated:

* STARTED Project 1 [1/3]
** DONE task 1
** TODO task 2
** TODO task 3

In the following example, the statistics are updated but the hook is not
called

* TODO Project 1 [1/3]
- [X] task 1
- [ ] task 2
- [ ] task 3

Is it possible to change it to call the hook for the second example?

Dave
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode