babel: `org-babel-tangle-w-comments' controls comment insertion in tangled code

* contrib/babel/lisp/org-babel-tangle.el (org-babel-spec-to-string):
  The insertion of automatically generated comments into tangled code
  is now customizable through the `org-babel-tangle-w-comments'
  variable.
This commit is contained in:
Eric Schulte 2010-05-27 16:32:10 -06:00
parent 5349014e82
commit ff58dacc7c
1 changed files with 7 additions and 1 deletions

View File

@ -40,6 +40,11 @@ to use when writing out the language to file, and an optional
fourth element is a flag which when true indicates that the
language does not support comments.")
(defvar org-babel-tangle-w-comments nil
"Control the insertion of comments into tangled code. Non-nil
value will result in the insertion of comments for those
languages with comment support.")
(defun org-babel-load-file (file)
"Load the contents of the Emacs Lisp source code blocks in the
org-mode formatted FILE. This function will first export the
@ -218,7 +223,8 @@ form
(link source-name params body)"
(flet ((insert-comment (text)
(when commentable
(when (and commentable
org-babel-tangle-w-comments)
(insert "\n")
(comment-region (point) (progn (insert text) (point)))
(end-of-line nil)