瀏覽代碼

ob-R.el: fix a bug when a :var is propertized text

* lisp/ob-R.el (org-babel-R-assign-elisp): Strip text properties from
strings.

Before this change, babel would try to format propertized strings
using elisp read syntax.  The upshot is that evaluating the following
code block would give an error (in R, not emacs), since the “bar” in
foo-ex gets text properties via font lock:

| #+name: foo-ex
| #+begin_example
| bar
| #+end_example
|
| #+name: foo
| #+begin_src R :var foo=foo-ex
|   foo
| #+end_src
Aaron Ecay 10 年之前
父節點
當前提交
d035c14765
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lisp/ob-R.el

+ 1 - 1
lisp/ob-R.el

@@ -242,7 +242,7 @@ This function is called by `org-babel-execute-src-block'."
 		    name file header row-names max))))
     (cond ((integerp value) (format "%s <- %s" name (concat (number-to-string value) "L")))
 	  ((floatp   value) (format "%s <- %s" name value))
-	  ((stringp  value) (format "%s <- %S" name value))
+	  ((stringp  value) (format "%s <- %S" name (org-no-properties value)))
 	  (t                (format "%s <- %S" name (prin1-to-string value))))))