Browse Source

ob-tangle.el (org-babel-tangle-collect-blocks): Don't collect blocks in commented out headings

* ob-tangle.el (org-babel-tangle-collect-blocks): Don't
collect blocks in commented out headings.

Thansk to the various people who requested this.
Bastien Guerry 8 years ago
parent
commit
8e0b4529f7
1 changed files with 4 additions and 3 deletions
  1. 4 3
      lisp/ob-tangle.el

+ 4 - 3
lisp/ob-tangle.el

@@ -373,12 +373,13 @@ code blocks by language."
 				     (or (nth 4 (org-heading-components))
 					 "(dummy for heading without text)")
 				   (error (buffer-file-name)))))
-      (let* ((start-line (save-restriction (widen)
-					   (+ 1 (line-number-at-pos (point)))))
+      (let* ((start-line
+	      (save-restriction (widen) (+ 1 (line-number-at-pos (point)))))
 	     (file (buffer-file-name))
 	     (info (org-babel-get-src-block-info 'light))
 	     (src-lang (nth 0 info)))
-        (unless (string= (cdr (assoc :tangle (nth 2 info))) "no")
+        (unless (or (string-match (concat "^" org-comment-string) current-heading)
+		    (string= (cdr (assoc :tangle (nth 2 info))) "no"))
           (unless (and language (not (string= language src-lang)))
 	    (let* ((info (org-babel-get-src-block-info))
 		   (params (nth 2 info))