Function: org-babel-spec-to-string
org-babel-spec-to-string is a byte-compiled function defined in
ob-tangle.el.gz.
Signature
(org-babel-spec-to-string SPEC)
Documentation
Insert SPEC into the current file.
Insert the source-code specified by SPEC into the current source
code file. This function uses comment-region which assumes
that the appropriate major-mode is set. SPEC has the form:
(start-line file link source-name params body comment)
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-tangle.el.gz
(defun org-babel-spec-to-string (spec)
"Insert SPEC into the current file.
Insert the source-code specified by SPEC into the current source
code file. This function uses `comment-region' which assumes
that the appropriate major-mode is set. SPEC has the form:
(start-line file link source-name params body comment)"
(pcase-let*
((`(,start ,file ,link ,source ,info ,body ,comment) spec)
(comments (cdr (assq :comments info)))
(link? (or (string= comments "both") (string= comments "link")
(string= comments "yes") (string= comments "noweb")))
(link-data `(("start-line" . ,(number-to-string start))
("file" . ,file)
("link" . ,link)
("source-name" . ,source)))
(insert-comment (lambda (text)
(when (and comments
(not (string= comments "no"))
(org-string-nw-p text))
(if org-babel-tangle-uncomment-comments
;; Plain comments: no processing.
(insert text)
;; Ensure comments are made to be
;; comments, and add a trailing newline.
;; Also ignore invisible characters when
;; commenting.
(comment-region
(point)
(progn (insert (org-no-properties text))
(point)))
(end-of-line)
(insert "\n"))))))
(when comment (funcall insert-comment comment))
(when link?
(funcall insert-comment
(org-fill-template
org-babel-tangle-comment-format-beg link-data)))
(insert body "\n")
(when link?
(funcall insert-comment
(org-fill-template
org-babel-tangle-comment-format-end link-data)))))