summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-07-15 09:26:43 -0600
committerEric Schulte <schulte.eric@gmail.com>2011-07-15 09:26:43 -0600
commit8834bde39f90e0fa54d998f107af07e545d1165e (patch)
tree869a4dd8b9f0cd7c7112dc798a0fdf70355c44d1
parent407b87e9d9c7150ba5bebaac9c2bc7ef50e96ec7 (diff)
downloadorg-mode-8834bde39f90e0fa54d998f107af07e545d1165e.tar.gz
ob: strip *single* trailing newline from code block bodies
-rw-r--r--lisp/ob.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index dfec223..988ea99 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -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