Ver código fonte

Fix issue with turning off ORDERED property

* lisp/org-macs.el (org-not-nil): New function.
* lisp/org.el (org-block-todo-from-children-or-siblings-or-parent):
Use `org-not-nil' to interpret a property value of nil.

Robert Goldman writes:

> I have found what I believe to be a bug in handling ordered subtasks.
> Here is the behavior:
>
> I have a top level set of tasks that is ordered.
>
> One of the outline items below the top level set is a grab bag of tasks
> that will be performed in parallel.  So this task is NOT ordered
> (ORDERED: nil).
>
> The problem is that the blocking behavior from ordered tasks seems to be
> inherited from the top level task list into the second level of the
> outline, even though the ORDERED property at the second level is
> explicitly overridden.
>
> I am attaching an org file that displays this issue.  To see the
> problem, put your cursor on the "Bar" task and attempt to change its
> status to DONE.

The problem was here that the value of the property is the string
"nil", which is of course not nil.

This patches introduces a special case to interpret "nil" as nil.
Carsten Dominik 14 anos atrás
pai
commit
a547c1048b
2 arquivos alterados com 6 adições e 2 exclusões
  1. 4 0
      lisp/org-macs.el
  2. 2 2
      lisp/org.el

+ 4 - 0
lisp/org-macs.el

@@ -43,6 +43,10 @@
   "Return the value of symbol VAR if it is bound, else nil."
   `(and (boundp (quote ,var)) ,var))
 
+(defun org-not-nil (v)
+  "Is V not nil, and also not the string \"nil\"?"
+  (and v (not (equal v "nil"))))
+
 (defmacro org-unmodified (&rest body)
   "Execute body without changing `buffer-modified-p'.
 Also, do not record undo information."

+ 2 - 2
lisp/org.el

@@ -10881,7 +10881,7 @@ changes.  Such blocking occurs when:
 	(let* ((pos (point))
 	       (parent-pos (and (org-up-heading-safe) (point))))
 	  (if (not parent-pos) (throw 'dont-block t)) ; no parent
-	  (when (and (org-entry-get (point) "ORDERED")
+	  (when (and (org-not-nil (org-entry-get (point) "ORDERED"))
 		     (forward-line 1)
 		     (re-search-forward org-not-done-heading-regexp pos t))
 	    (throw 'dont-block nil))  ; block, there is an older sibling not done.
@@ -10893,7 +10893,7 @@ changes.  Such blocking occurs when:
 	    (setq pos (point))
 	    (setq parent-pos (and (org-up-heading-safe) (point)))
 	    (if (not parent-pos) (throw 'dont-block t)) ; no parent
-	    (when (and (org-entry-get (point) "ORDERED")
+	    (when (and (org-not-nil (org-entry-get (point) "ORDERED"))
 		       (forward-line 1)
 		       (re-search-forward org-not-done-heading-regexp pos t))
 	      (throw 'dont-block nil)))))))) ; block, older sibling not done.