Browse Source

babel: Don't trim whitespace when `org-src-preserve-indentation' is non-nil

	* ob-tangle.el (org-babel-spec-to-string): Don't trim
	whitespace when `org-src-preserve-indentation' is non-nil

	* ob-python.el (org-babel-expand-body:python): Don't trim
	whitespace when `org-src-preserve-indentation' is non-nil

Based on report and patches by Antti Kaihola.
Dan Davison 14 years ago
parent
commit
deb391f128
2 changed files with 2 additions and 2 deletions
  1. 1 1
      lisp/ob-python.el
  2. 1 1
      lisp/ob-tangle.el

+ 1 - 1
lisp/ob-python.el

@@ -56,7 +56,7 @@
               (car pair)
               (org-babel-python-var-to-python (cdr pair))))
     (nth 1 (or processed-params (org-babel-process-params params))) "\n")
-   "\n" (org-babel-trim body) "\n"))
+   "\n" (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")) "\n"))
 
 (defun org-babel-execute:python (body params)
   "Execute a block of Python code with Babel.

+ 1 - 1
lisp/ob-tangle.el

@@ -366,7 +366,7 @@ form
 	 (org-fill-template org-babel-tangle-comment-format-beg link-data)))
       (when org-babel-tangle-pad-newline (insert "\n"))
       (insert (format "%s\n" (replace-regexp-in-string
-			      "^," "" (org-babel-trim body))))
+			      "^," "" (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")))))
       (when link-p
 	(insert-comment
 	 (org-fill-template org-babel-tangle-comment-format-end link-data))))))