Selaa lähdekoodia

org-depend: Fix blocking logic

* contrib/lisp/org-depend.el (org-depend-block-todo): Fix blocking logic.

Paul Sexton writes:

> The value returned by org-depend-block-todo determines whether an item
> is considered "blocked", and thus whether it is shown dimmed (because
> this function is added to org-blocker-hook).
>
> o-d-b-t only returns true in a very limited set of conditions, so very
> often items which should show up as blocked, do not. To be honest I
> don't remember the exact details, but it did not work before I applied
> the patch, and has worked correctly ever since.
Carsten Dominik 14 vuotta sitten
vanhempi
commit
2f9d095617
1 muutettua tiedostoa jossa 7 lisäystä ja 6 poistoa
  1. 7 6
      contrib/lisp/org-depend.el

+ 7 - 6
contrib/lisp/org-depend.el

@@ -224,12 +224,13 @@ this ID property, that entry is also checked."
 	 blocker blockers bl p1
 	 (proceed-p
 	  (catch 'return
-	    (unless (eq type 'todo-state-change)
-	      ;; We are not handling this kind of change
-	      (throw 'return t))
-	    (unless (and (not from) (member to org-not-done-keywords))
-	      ;; This is not a change from nothing to TODO, ignore it
-	      (throw 'return t))
+            ;; If this is not a todo state change, or if this entry is
+            ;; DONE, do not block
+            (when (or (not (eq type 'todo-state-change))
+                      (member from (cons 'done org-done-keywords))
+                      (member to (cons 'todo org-not-done-keywords))
+                      (not to))
+              (throw 'return t))
 
 	    ;; OK, the plan is to switch from nothing to TODO
 	    ;; Lets see if we will allow it.  Find the BLOCKER property