Hi Tom,
I am hesitant to apply this relatively complex patch which
I have not had the time to study closely enough.
I am wondering: Instead of setting a TODO keyword,
would it not be simpler and equally effective to set a
special tag when an entry is blocked?
That is a much better solution. I have coded that and tested it
against
an example file, and it works.
I've attached a patch. One note: I used diff flag -b to ignore
whitespace
because most of the change is that the big `catch' statement isn't
directly returned but assigned to proceed-p. So most of it got
indented
further but no change other than whitespace. I can diff it without -
b if
you prefer.
You could use a bright font to mark this tag, in order to
make it obvious. And you could use a custom query to look
for blocked items, to see what can be done about them....
Tom Breton (Tehom)
[example-file.org]
* Header
** TODO Blocking item
** Item that gets blocked
:PROPERTIES:
:BLOCKER: previous-sibling
:END:
[end]
[begin patch]
*** old-org-depend.el 2009-01-04 03:01:50.000000000 -0500
--- ord-depend.el 2009-01-14 21:15:47.000000000 -0500
***************
*** 112,117 ****
--- 112,121 ----
;;
(require 'org)
+ (defcustom org-tag-blocked-depends t
+ "Whether to indicate blocked TODO items by a special tag."
+ :group 'org
+ :type 'bool)
(defun org-depend-trigger-todo (change-plist)
"Trigger new TODO entries after the current is switched to DONE.
***************
*** 191,197 ****
(from (plist-get change-plist :from))
(to (plist-get change-plist :to))
(org-log-done nil) ; IMPROTANT!: no logging during automatic
trigger
! blocker blockers bl p1)
(catch 'return
(unless (eq type 'todo-state-change)
;; We are not handling this kind of change
--- 195,202 ----
(from (plist-get change-plist :from))
(to (plist-get change-plist :to))
(org-log-done nil) ; IMPROTANT!: no logging during automatic
trigger
! blocker blockers bl p1
! (proceed-p
(catch 'return
(unless (eq type 'todo-state-change)
;; We are not handling this kind of change
***************
*** 234,239 ****
--- 239,251 ----
(throw 'return nil))))))
t ; return t to indicate that we are not blocking
)))
+ (when org-tag-blocked-depends
+ (org-toggle-tag "blocked"
+ (if proceed-p 'off 'on)))
+
+ proceed-p))
+
+
(add-hook 'org-trigger-hook 'org-depend-trigger-todo)
(add-hook 'org-blocker-hook 'org-depend-block-todo)
[end patch]