From 8834bde39f90e0fa54d998f107af07e545d1165e Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Fri, 15 Jul 2011 09:26:43 -0600 Subject: [PATCH] ob: strip *single* trailing newline from code block bodies --- lisp/ob.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ob.el b/lisp/ob.el index dfec223f9..988ea99c4 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 -- 2.11.4.GIT