summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-27 00:10:10 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-27 00:10:10 +0100
commitf2e861e0bebda29cd57b4803a8d90449ea0ac4a2 (patch)
tree56b907868a253d4865b3cef0165e9b4ebf5bdc3c
parent1f8fb3cf54fddad9ff0cb487754e1818044e5dea (diff)
downloadorg-mode-f2e861e0bebda29cd57b4803a8d90449ea0ac4a2.tar.gz
Small refactoring
* lisp/org.el (org--property-global-value): New function. (org-entry-get-with-inheritance): Use new function.
-rw-r--r--lisp/org.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el
index d51ae3f..ff11c03 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16016,6 +16016,17 @@ unless LITERAL-NIL is non-nil."
;; Return final values.
(and (not (equal value '(nil))) (nreverse value))))))
+(defun org--property-global-value (property literal-nil)
+ "Return value for PROPERTY in current buffer.
+Return value is a string. Return nil if property is not set
+globally. Also return nil when PROPERTY is set to \"nil\",
+unless LITERAL-NIL is non-nil."
+ (let ((global
+ (cdr (or (assoc-string property org-file-properties t)
+ (assoc-string property org-global-properties t)
+ (assoc-string property org-global-properties-fixed t)))))
+ (if literal-nil global (org-not-nil global))))
+
(defun org-entry-get (pom property &optional inherit literal-nil)
"Get value of PROPERTY for entry or content at point-or-marker POM.
@@ -16168,10 +16179,7 @@ However, if LITERAL-NIL is set, return the string value \"nil\" instead."
(throw 'exit nil))
((org-up-heading-safe))
(t
- (let ((global
- (cdr (or (assoc-string property org-file-properties t)
- (assoc-string property org-global-properties t)
- (assoc-string property org-global-properties-fixed t)))))
+ (let ((global (org--property-global-value property literal-nil)))
(cond ((not global))
(value (setq value (concat global " " value)))
(t (setq value global))))