Browse Source

ob-tangle: Correctly unescape code when tangling

* lisp/ob-tangle.el (org-babel-spec-to-string): Use dedicated function
  for unescaping code.
Nicolas Goaziou 12 years ago
parent
commit
8ef19cdeee
1 changed files with 6 additions and 7 deletions
  1. 6 7
      lisp/ob-tangle.el

+ 6 - 7
lisp/ob-tangle.el

@@ -309,12 +309,12 @@ references."
 (defvar org-bracket-link-regexp)
 (defun org-babel-spec-to-string (spec)
   "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))
 	 (file (nth 1 spec))
 	 (link (nth 2 spec))
@@ -346,8 +346,7 @@ form
     (insert
      (format
       "%s\n"
-      (replace-regexp-in-string
-       "^," ""
+      (org-unescape-code-in-string
        (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")))))
     (when link-p
       (funcall