org.el (org-entry-get): Fix inheritance problem

* org.el (org-entry-get): Only try to combine file properties
with local properties when the property drawer contains such
local property, not when the property drawer exists.

Before the fix, `org-entry-get' behavior was inconsistent,
returning `nil' when looking for a property in a subtree with
no property drawer, and returning the global properties in a
subtree with a property drawer, independantly of whether this
property drawer contained a reference to the property we are checking
against or not.

As a side-effect, inheritance was broken for the case that
Ilya reported in commit 475f2f53, because `org-entry-get' returned
a value (with the global properties of the file) too early.

Thanks to Ilya for raising this bug and to Achim for pointing
out that the previous fix was wrong.
This commit is contained in:
Bastien Guerry 2014-03-18 14:47:09 +01:00
parent 3074d081e7
commit 42ee862d33
1 changed files with 7 additions and 1 deletions

View File

@ -15324,7 +15324,13 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy."
(cdr (assoc property (org-entry-properties nil 'special property)))
(org-with-wide-buffer
(let ((range (org-get-property-block)))
(when (and range (not (eq (car range) (cdr range))))
(when (and range (not (eq (car range) (cdr range)))
(save-excursion
(goto-char (car range))
(re-search-forward
(concat (org-re-property property) "\\|"
(org-re-property (concat property "+")))
(cdr range) t)))
(let* ((props
(list (or (assoc property org-file-properties)
(assoc property org-global-properties)