Browse Source

org-babel-tangle: now conservative about whitespace insertion around tangled blocks

Eric Schulte 15 years ago
parent
commit
cd405fad22
1 changed files with 5 additions and 5 deletions
  1. 5 5
      contrib/babel/lisp/org-babel-tangle.el

+ 5 - 5
contrib/babel/lisp/org-babel-tangle.el

@@ -183,17 +183,17 @@ form
   (link source-name params body)"
   (flet ((insert-comment (text)
                          (when commentable
+                           (insert "\n")
                            (comment-region (point) (progn (insert text) (point)))
-                           (move-end-of-line nil))))
+                           (move-end-of-line nil)
+                           (insert "\n"))))
     (let ((link (first spec))
           (source-name (second spec))
           (body (fourth spec))
           (commentable (not (fifth spec))))
-      (insert "\n\n")
       (insert-comment (format "[[%s][%s]]" (org-link-escape link) source-name))
-      (insert (format "\n%s\n" (org-babel-chomp body)))
-      (insert-comment (format "%s ends here" source-name))
-      (insert "\n"))))
+      (insert (format "%s" (org-babel-chomp body)))
+      (insert-comment (format "%s ends here" source-name)))))
 
 (provide 'org-babel-tangle)
 ;;; org-babel-tangle.el ends here