浏览代码

ob: `substring' comparison instead of regexp matching

* lisp/ob.el (org-babel-script-escape): Use `substring' comparison
instead of regexp matching

Workaround for regexp limitation, e.g.

(string-match
 "^\\[.+\\]$"
 (concat
  "["
  (mapconcat (lambda (i) "x") (number-sequence 1 33500) "")
  "]"))

gives "Stack overflow in regexp matcher" in several current builds.
Dan Davison 14 年之前
父节点
当前提交
a8f2163d76
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lisp/ob.el

+ 4 - 1
lisp/ob.el

@@ -1857,7 +1857,10 @@ block but are passed literally to the \"example-block\"."
   "Safely convert tables into elisp lists."
   (let (in-single in-double out)
     (org-babel-read
-     (if (and (stringp str) (string-match "^\\[.+\\]$" str))
+     (if (and (stringp str)
+	      (> (length str) 2)
+	      (string-equal "[" (substring str 0 1))
+	      (string-equal "]" (substring str -1)))
 	 (org-babel-read
 	  (concat
 	   "'"