diff options
author | Dan Davison <davison@stats.ox.ac.uk> | 2010-10-12 15:47:59 +0100 |
---|---|---|
committer | Dan Davison <davison@stats.ox.ac.uk> | 2010-10-12 15:47:59 +0100 |
commit | deb391f128b946dcd7ea96d96d231f8fc373aaba (patch) | |
tree | c087c0179f9aa2926fa5a81c855bcc558117fe31 | |
parent | 70e52ba9ac15c95a49ca2052438b3d9680b1f8b3 (diff) | |
download | org-mode-deb391f128b946dcd7ea96d96d231f8fc373aaba.tar.gz |
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.
-rw-r--r-- | lisp/ob-python.el | 2 | ||||
-rw-r--r-- | lisp/ob-tangle.el | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lisp/ob-python.el b/lisp/ob-python.el index c172756..9c72cf2 100644 --- a/lisp/ob-python.el +++ b/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. diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 3a0426a..2fd415b 100644 --- a/lisp/ob-tangle.el +++ b/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)))))) |