summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2014-06-07 11:29:03 -0400
committerEric Schulte <schulte.eric@gmail.com>2014-06-07 11:29:03 -0400
commita3745c375baba33ead78edac2515737cd8d0e78c (patch)
treed29c0a2d95eeb019f2f547053f8bfcce85a2505d
parentc3e497f394994cf89dd74087685acc82dc12b91d (diff)
downloadorg-mode-a3745c375baba33ead78edac2515737cd8d0e78c.tar.gz
tangle option to not post-process tangle comments
* lisp/ob-tangle.el (org-babel-tangle-comment-format-beg): Mention the new `org-babel-tangle-uncomment-comments' variable in the documentation. (org-babel-tangle-comment-format-end): Mention the new `org-babel-tangle-uncomment-comments' variable in the documentation. (org-babel-tangle-uncomment-comments): New customization variable to inhibit the post-processing of tangle comments. (org-babel-spec-to-string): Post-processing of tangle comments is now dependent upon a customization variable.
-rw-r--r--lisp/ob-tangle.el29
1 files changed, 27 insertions, 2 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 2bb7e2d..1c159a5 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -88,6 +88,11 @@ information into the output using `org-fill-template'.
%link --------- Org-mode style link to the code block
%source-name -- name of the code block
+Upon insertion the formatted comment will be commented out, and
+followed by a newline. To inhibit this post-insertion processing
+set the `org-babel-tangle-uncomment-comments' variable to a
+non-nil value.
+
Whether or not comments are inserted during tangling is
controlled by the :comments header argument."
:group 'org-babel
@@ -103,12 +108,25 @@ information into the output using `org-fill-template'.
%link --------- Org-mode style link to the code block
%source-name -- name of the code block
+Upon insertion the formatted comment will be commented out, and
+followed by a newline. To inhibit this post-insertion processing
+set the `org-babel-tangle-uncomment-comments' variable to a
+non-nil value.
+
Whether or not comments are inserted during tangling is
controlled by the :comments header argument."
:group 'org-babel
:version "24.1"
:type 'string)
+(defcustom org-babel-tangle-uncomment-comments nil
+ "Inhibits automatic commenting and addition of trailing newline
+of tangle comments. Use `org-babel-tangle-comment-format-beg'
+and `org-babel-tangle-comment-format-end' to customize the format
+of tangled comments."
+ :group 'org-babel
+ :type 'boolean)
+
(defcustom org-babel-process-comment-text #'org-remove-indentation
"Function called to process raw Org-mode text collected to be
inserted as comments in tangled source-code files. The function
@@ -342,8 +360,15 @@ that the appropriate major-mode is set. SPEC has the form:
(insert-comment (lambda (text)
(when (and comments (not (string= comments "no"))
(> (length text) 0))
- (comment-region (point) (progn (insert text) (point)))
- (end-of-line nil) (insert "\n")))))
+ (if org-babel-tangle-uncomment-comments
+ ;; just plain comments with no processing
+ (insert text)
+ ;; ensure comments are made to be
+ ;; comments, and add a trailing newline
+ (comment-region
+ (point) (progn (insert text) (point)))
+ (end-of-line nil)
+ (insert "\n"))))))
(when comment (funcall insert-comment comment))
(when link-p
(funcall