Browse Source

ob: Ensure all portions of results wrappers end in newlines

* lisp/ob.el (org-babel-insert-result): Ensure all parts of result
  wrappers end in newlines.
Eric Schulte 14 years ago
parent
commit
3d4b884cb3
1 changed files with 7 additions and 7 deletions
  1. 7 7
      lisp/ob.el

+ 7 - 7
lisp/ob.el

@@ -1493,25 +1493,25 @@ code ---- the results are extracted in the syntax of the source
 	(setq end (point-marker))
 	;; possibly wrap result
 	(flet ((wrap (start finish)
-		     (goto-char beg) (insert start)
-		     (goto-char end) (insert finish)
+		     (goto-char beg) (insert (concat start "\n"))
+		     (goto-char end) (insert (concat finish "\n"))
 		     (setq end (point-marker))))
 	  (cond
 	   ((member "html" result-params)
-	    (wrap "#+BEGIN_HTML\n" "#+END_HTML"))
+	    (wrap "#+BEGIN_HTML" "#+END_HTML"))
 	   ((member "latex" result-params)
-	    (wrap "#+BEGIN_LaTeX\n" "#+END_LaTeX"))
+	    (wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
 	   ((member "code" result-params)
-	    (wrap (format "#+BEGIN_SRC %s%s\n" (or lang "none") results-switches)
+	    (wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
 		  "#+END_SRC"))
 	   ((member "org" result-params)
-	    (wrap "#+BEGIN_ORG\n" "#+END_ORG"))
+	    (wrap "#+BEGIN_ORG" "#+END_ORG"))
 	   ((member "raw" result-params)
 	    (goto-char beg) (if (org-at-table-p) (org-cycle)))
 	   ((member "wrap" result-params)
 	    (when (and (stringp result) (not (member "file" result-params)))
 	      (org-babel-examplize-region beg end results-switches))
-	    (wrap "#+BEGIN_RESULT\n" "#+END_RESULT"))
+	    (wrap "#+BEGIN_RESULT" "#+END_RESULT"))
 	   ((and (stringp result) (not (member "file" result-params)))
 	    (org-babel-examplize-region beg end results-switches)
 	    (setq end (point)))))