summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-10-01 18:57:50 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-10-01 19:01:58 +0200
commit018fb0149d0171a9a6e18a148d3850742d380de8 (patch)
tree47528537abc059a6a9fcd91b45fcbac6207a74cb
parent4fdac06ef1d569d0c806169a7c0a526cddff2d48 (diff)
downloadorg-mode-018fb0149d0171a9a6e18a148d3850742d380de8.tar.gz
Fix parsing properties with title or summary type
* testing/lisp/test-org.el (test-org/buffer-property-keys): Ignore title and summary type when extracting name. Reported-by: Adrian Bradd <adrian.bradd@gmail.com> <http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00001.html>
-rw-r--r--lisp/org.el4
-rw-r--r--testing/lisp/test-org.el15
2 files changed, 17 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 99318ad..386ea47 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16071,7 +16071,9 @@ automatically performed, such drawers will be silently ignored."
(when (memq (org-element-type element) '(keyword node-property))
(let ((value (org-element-property :value element))
(start 0))
- (while (string-match "%[0-9]*\\(\\S-+\\)" value start)
+ (while (string-match "%[0-9]*\\([[:alnum:]_-]+\\)\\(([^)]+)\\)?\
+\\(?:{[^}]+}\\)?"
+ value start)
(setq start (match-end 0))
(let ((p (match-string-no-properties 1 value)))
(unless (member-ignore-case p org-special-properties)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index c4a2a58..b9b4004 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -4922,7 +4922,20 @@ Paragraph<point>"
(equal '("A")
(org-test-with-temp-text
"* a\n:PROPERTIES:\n:A: 1\n:END:\n* b\n:PROPERTIES:\nsome junk here\n:END:\n"
- (org-buffer-property-keys nil nil nil t)))))
+ (org-buffer-property-keys nil nil nil t))))
+ ;; In COLUMNS, ignore label title and summary-type.
+ (should
+ (equal '("A")
+ (org-test-with-temp-text "#+COLUMNS: %A(Foo)"
+ (org-buffer-property-keys nil nil t))))
+ (should
+ (equal '("A")
+ (org-test-with-temp-text "#+COLUMNS: %A{Foo}"
+ (org-buffer-property-keys nil nil t))))
+ (should
+ (equal '("A")
+ (org-test-with-temp-text "#+COLUMNS: %A(Foo){Bar}"
+ (org-buffer-property-keys nil nil t)))))
(ert-deftest test-org/property-values ()
"Test `org-property-values' specifications."