diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2011-07-15 09:26:43 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2011-07-15 09:26:43 -0600 |
commit | 8834bde39f90e0fa54d998f107af07e545d1165e (patch) | |
tree | 869a4dd8b9f0cd7c7112dc798a0fdf70355c44d1 | |
parent | 407b87e9d9c7150ba5bebaac9c2bc7ef50e96ec7 (diff) | |
download | org-mode-8834bde39f90e0fa54d998f107af07e545d1165e.tar.gz |
ob: strip *single* trailing newline from code block bodies
-rw-r--r-- | lisp/ob.el | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -957,7 +957,11 @@ may be specified in the current buffer." (lang (org-babel-clean-text-properties (match-string 2))) (lang-headers (intern (concat "org-babel-default-header-args:" lang))) (switches (match-string 3)) - (body (org-babel-clean-text-properties (match-string 5))) + (body (org-babel-clean-text-properties + (let* ((body (match-string 5)) + (sub-length (- (length body) 1))) + (when (string= "\n" (substring body sub-length)) + (substring body 0 sub-length))))) (preserve-indentation (or org-src-preserve-indentation (string-match "-i\\>" switches)))) (list lang |