added function: org-babel-tangle-clean, for cleaning up tangled files
This commit is contained in:
parent
be06c11268
commit
beed8c097b
|
@ -136,6 +136,19 @@ exported source code blocks by language."
|
|||
(if (> block-counter 1) "s" ""))
|
||||
path-collector)))
|
||||
|
||||
(defun org-babel-tangle-clean ()
|
||||
"Call this function inside of a source-code file generated by
|
||||
`org-babel-tangle' to remove all comments inserted automatically
|
||||
by `org-babel-tangle'. Warning, this comment removes any lines
|
||||
containing constructs which resemble org-mode file links or noweb
|
||||
references."
|
||||
(interactive)
|
||||
(goto-char (point-min))
|
||||
(while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t)
|
||||
(re-search-forward "<<[^[:space:]]*>>" nil t))
|
||||
(delete-region (save-excursion (move-beginning-of-line 1) (point))
|
||||
(save-excursion (move-end-of-line 1) (forward-char 1) (point)))))
|
||||
|
||||
(defun org-babel-tangle-collect-blocks (&optional lang)
|
||||
"Collect all source blocks in the current org-mode file.
|
||||
Return an association list of source-code block specifications of
|
||||
|
@ -191,8 +204,7 @@ form
|
|||
|
||||
(defun org-babel-expand-noweb-references (&optional info parent-buffer)
|
||||
"This function expands Noweb style references in the body of
|
||||
the current source-code block. The reference must be inside of a
|
||||
comment or it will be skipped. For example the following
|
||||
the current source-code block. For example the following
|
||||
reference would be replaced with the body of the source-code
|
||||
block named 'example-block' (assuming the '#' character starts a
|
||||
comment) .
|
||||
|
|
Loading…
Reference in New Issue