summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-15 16:43:06 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-07-15 16:43:06 -0700
commit46fec6b08b8d18d6904cca271478553f41471857 (patch)
tree76d76af5627f232a9dc4e8c82832bd63a674103a
parent2cd33b94d9327f365f0a1b77aa15b87b627cab35 (diff)
downloadorg-mode-46fec6b08b8d18d6904cca271478553f41471857.tar.gz
ob-C: removing excess newlines around expanded C code bodies
* lisp/ob-C.el (org-babel-C-expand): removing excess newlines around expanded C code bodies
-rw-r--r--lisp/ob-C.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 9873255..cdfaa91 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -131,22 +131,23 @@ it's header arguments."
(defines (org-babel-read
(or (cdr (assoc :defines params))
(org-babel-read (org-entry-get nil "defines" t))))))
- (mapconcat 'identity
- (list
- ;; includes
- (mapconcat
- (lambda (inc) (format "#include %s" inc))
- (if (listp includes) includes (list includes)) "\n")
- ;; defines
- (mapconcat
- (lambda (inc) (format "#define %s" inc))
- (if (listp defines) defines (list defines)) "\n")
- ;; variables
- (mapconcat 'org-babel-C-var-to-C vars "\n")
- ;; body
- (if main-p
- (org-babel-C-ensure-main-wrap body)
- body) "\n") "\n")))
+ (org-babel-trim
+ (mapconcat 'identity
+ (list
+ ;; includes
+ (mapconcat
+ (lambda (inc) (format "#include %s" inc))
+ (if (listp includes) includes (list includes)) "\n")
+ ;; defines
+ (mapconcat
+ (lambda (inc) (format "#define %s" inc))
+ (if (listp defines) defines (list defines)) "\n")
+ ;; variables
+ (mapconcat 'org-babel-C-var-to-C vars "\n")
+ ;; body
+ (if main-p
+ (org-babel-C-ensure-main-wrap body)
+ body) "\n") "\n"))))
(defun org-babel-C-ensure-main-wrap (body)
"Wrap body in a \"main\" function call if none exists."