Browse Source

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>
Nicolas Goaziou 7 years ago
parent
commit
018fb0149d
2 changed files with 17 additions and 2 deletions
  1. 3 1
      lisp/org.el
  2. 14 1
      testing/lisp/test-org.el

+ 3 - 1
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)

+ 14 - 1
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."