summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-09-02 12:34:47 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-09-02 12:34:47 +0200
commitf51a72c95c3368617f82286cd107008b714dc38e (patch)
treed71d6215b9e4a0f7ca22b0d370ffbd83358461da
parenta4a1d85ed0d62e7713d515b967b1bc1580ec398d (diff)
parent2de0c1c3da1e7f9859b82d8af0167c60545c5c5f (diff)
downloadorg-mode-f51a72c95c3368617f82286cd107008b714dc38e.tar.gz
Merge branch 'maint'
Conflicts: lisp/org.el
-rwxr-xr-xlisp/org.el20
-rw-r--r--testing/lisp/test-org-element.el2
2 files changed, 15 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 2b3d00a..f343a69 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6257,12 +6257,20 @@ Use `org-reduced-level' to remove the effect of `org-odd-levels'."
(defsubst org-re-property (property &optional literal allow-null)
"Return a regexp matching a PROPERTY line.
- Match group 3 will be set to the value if it exists."
- (concat "^\\(?4:[ \t]*\\)\\(?1::\\(?2:"
- (if literal property (regexp-quote property))
- "\\):\\)\\(?:[ \t]+\\(?3:[^ \t\r\n].*?\\)\\)"
- (and allow-null "?")
- "\\(?5:[ \t]*\\)$"))
+
+When optional argument LITERAL is non-nil, do not quote PROPERTY.
+This is useful when PROPERTY is a regexp. When ALLOW-NULL is
+non-nil, match properties even without a value.
+
+Match group 3 is set to the value when it exists. If there is no
+value and ALLOW-NULL is non-nil, it is set to the empty string."
+ (concat
+ "^\\(?4:[ \t]*\\)"
+ (format "\\(?1::\\(?2:%s\\):\\)"
+ (if literal property (regexp-quote property)))
+ (if allow-null
+ "\\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$"
+ "[ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$")))
(defconst org-property-re
(org-re-property ".*?" 'literal t)
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 6fb8db8..9b1ca77 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1587,7 +1587,7 @@ e^{i\\pi}+1=0
(org-element-type (org-element-at-point)))))
;; Accept empty properties.
(should
- (equal '(("foo" "value") ("bar" nil))
+ (equal '(("foo" "value") ("bar" ""))
(org-test-with-temp-text ":PROPERTIES:\n:foo: value\n:bar:\n:END:"
(org-element-map (org-element-parse-buffer) 'node-property
(lambda (p)