فهرست منبع

Merge branch 'maint'

Nicolas Goaziou 12 سال پیش
والد
کامیت
787a07421c
2فایلهای تغییر یافته به همراه17 افزوده شده و 3 حذف شده
  1. 5 2
      lisp/org-element.el
  2. 12 1
      testing/lisp/test-org-element.el

+ 5 - 2
lisp/org-element.el

@@ -3116,10 +3116,13 @@ Assume point is at the macro."
 	  (end (point))
 	  (args (let ((args (org-match-string-no-properties 3)) args2)
 		  (when args
-		    (setq args (org-split-string args ","))
+		    ;; Do not use `org-split-string' since empty
+		    ;; strings are meaningful here.
+		    (setq args (split-string args ","))
 		    (while args
 		      (while (string-match "\\\\\\'" (car args))
-			;; Repair bad splits.
+			;; Repair bad splits, when comma is protected,
+                        ;; and thus not a real separator.
 			(setcar (cdr args) (concat (substring (car args) 0 -1)
 						   "," (nth 1 args)))
 			(pop args))

+ 12 - 1
testing/lisp/test-org-element.el

@@ -1292,7 +1292,18 @@ e^{i\\pi}+1=0
   ;; With arguments.
   (should
    (org-test-with-temp-text "{{{macro(arg1,arg2)}}}"
-     (org-element-map (org-element-parse-buffer) 'macro 'identity))))
+     (org-element-map (org-element-parse-buffer) 'macro 'identity)))
+  ;; Properly handle protected commas in arguments...
+  (should
+   (= 2
+      (length
+       (org-test-with-temp-text "{{{macro(arg1\\,arg1,arg2)}}}"
+	 (org-element-property :args (org-element-context))))))
+  ;; ... even when last argument ends with a protected comma.
+  (should
+   (equal '("C-,")
+	  (org-test-with-temp-text "{{{macro(C-\\,)}}}"
+	    (org-element-property :args (org-element-context))))))
 
 
 ;;;; Node Property