org-entry-get-with-inheritance: Fix inherited explicit nil value
* lisp/org.el (org-entry-get-with-inheritance): Do not ignore when property has explicit "nil" value. * testing/lisp/test-org.el (test-org/entry-get): Add test.
This commit is contained in:
parent
4f8c9f5ac5
commit
8320e4794e
|
@ -12958,7 +12958,8 @@ However, if LITERAL-NIL is set, return the string value \"nil\" instead."
|
|||
(org-element-at-point epom)
|
||||
(lambda (el)
|
||||
(pcase-let ((`(,val . ,val+)
|
||||
(org--property-local-values property literal-nil el)))
|
||||
;; Force LITERAL-NIL t.
|
||||
(org--property-local-values property t el)))
|
||||
(if (not val)
|
||||
;; PROPERTY+
|
||||
(prog1 nil ; keep looking for PROPERTY
|
||||
|
@ -12976,7 +12977,7 @@ However, if LITERAL-NIL is set, return the string value \"nil\" instead."
|
|||
;; only PROPERTY+).
|
||||
(unless found-inherited?
|
||||
(when-let ((global (org--property-global-or-keyword-value
|
||||
property literal-nil)))
|
||||
property t)))
|
||||
(setq values (cons global values))))
|
||||
(when values
|
||||
(setq values (mapconcat
|
||||
|
|
|
@ -6863,6 +6863,34 @@ Paragraph<point>"
|
|||
"#+PROPERTY: A 0\n* H\n:PROPERTIES:\n:A+: 1\n:END:"
|
||||
(org-mode-restart)
|
||||
(org-entry-get (point-max) "A" t))))
|
||||
;; Explicit nil value takes precedence over parent non-nil properties.
|
||||
(should-not
|
||||
(org-test-with-temp-text
|
||||
"* 1
|
||||
:PROPERTIES:
|
||||
:PROP: value
|
||||
:END:
|
||||
** 2
|
||||
:PROPERTIES:
|
||||
:PROP: nil
|
||||
:END:
|
||||
*** 3
|
||||
"
|
||||
(org-entry-get (point-max) "PROP" t)))
|
||||
(should
|
||||
(equal "value"
|
||||
(org-test-with-temp-text
|
||||
"* 1
|
||||
:PROPERTIES:
|
||||
:PROP: value
|
||||
:END:<point>
|
||||
** 2
|
||||
:PROPERTIES:
|
||||
:PROP: nil
|
||||
:END:
|
||||
*** 3
|
||||
"
|
||||
(org-entry-get nil "PROP" t))))
|
||||
;; document level property-drawer has precedance over
|
||||
;; global-property by PROPERTY-keyword.
|
||||
(should
|
||||
|
|
Loading…
Reference in New Issue