org-babel-tangle: now careful to only add one shebang per file

This commit is contained in:
Eric Schulte 2009-11-04 15:18:50 -07:00
parent cd405fad22
commit 260007e61f
1 changed files with 5 additions and 2 deletions

View File

@ -88,7 +88,8 @@ exported source code blocks by language."
(lang-specs (cdr (assoc lang org-babel-tangle-langs)))
(ext (first lang-specs))
(she-bang (second lang-specs))
(commentable (not (third lang-specs))))
(commentable (not (third lang-specs)))
she-banged)
(mapc
(lambda (spec)
(let* ((tangle (cdr (assoc :tangle (third spec))))
@ -113,7 +114,9 @@ exported source code blocks by language."
;; drop source-block to file
(with-temp-buffer
(funcall lang-f)
(when she-bang (insert (concat she-bang "\n")))
(when (and she-bang (not (member file-name she-banged)))
(insert (concat she-bang "\n"))
(setq she-banged (cons file-name she-banged)))
(when commentable
(comment-region
(point) (progn (insert "generated by org-babel-tangle") (point)))