浏览代码

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.
Eric Schulte 15 年之前
父节点
当前提交
ff58dacc7c
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      contrib/babel/lisp/org-babel-tangle.el

+ 7 - 1
contrib/babel/lisp/org-babel-tangle.el

@@ -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)