ob-tangle: Correctly unescape code when tangling

* lisp/ob-tangle.el (org-babel-spec-to-string): Use dedicated function
  for unescaping code.
This commit is contained in:
Nicolas Goaziou 2013-02-27 08:58:32 +01:00
parent 2c797c41d9
commit 8ef19cdeee

View file

@ -309,12 +309,12 @@ references."
(defvar org-bracket-link-regexp) (defvar org-bracket-link-regexp)
(defun org-babel-spec-to-string (spec) (defun org-babel-spec-to-string (spec)
"Insert SPEC into the current file. "Insert SPEC into the current file.
Insert the source-code specified by SPEC into the current
source code file. This function uses `comment-region' which
assumes that the appropriate major-mode is set. SPEC has the
form
(start-line file link source-name params body comment)" Insert the source-code specified by SPEC into the current source
code file. This function uses `comment-region' which assumes
that the appropriate major-mode is set. SPEC has the form:
\(start-line file link source-name params body comment)"
(let* ((start-line (nth 0 spec)) (let* ((start-line (nth 0 spec))
(file (nth 1 spec)) (file (nth 1 spec))
(link (nth 2 spec)) (link (nth 2 spec))
@ -346,8 +346,7 @@ form
(insert (insert
(format (format
"%s\n" "%s\n"
(replace-regexp-in-string (org-unescape-code-in-string
"^," ""
(org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]"))))) (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")))))
(when link-p (when link-p
(funcall (funcall