Noweb references can now be resolved from the library of babel.
* lisp/ob.el (org-babel-expand-noweb-references): Noweb references can now be resolved from the library of babel.
This commit is contained in:
parent
e919c97d7e
commit
f5f2851401
40
lisp/ob.el
40
lisp/ob.el
|
@ -1731,25 +1731,27 @@ block but are passed literally to the \"example-block\"."
|
||||||
(if evaluate
|
(if evaluate
|
||||||
(let ((raw (org-babel-ref-resolve source-name)))
|
(let ((raw (org-babel-ref-resolve source-name)))
|
||||||
(if (stringp raw) raw (format "%S" raw)))
|
(if (stringp raw) raw (format "%S" raw)))
|
||||||
(save-restriction
|
(or (nth 2 (assoc (intern source-name)
|
||||||
(widen)
|
org-babel-library-of-babel))
|
||||||
(let ((point (org-babel-find-named-block
|
(save-restriction
|
||||||
source-name)))
|
(widen)
|
||||||
(if point
|
(let ((point (org-babel-find-named-block
|
||||||
(save-excursion
|
source-name)))
|
||||||
(goto-char point)
|
(if point
|
||||||
(org-babel-trim
|
(save-excursion
|
||||||
(org-babel-expand-noweb-references
|
(goto-char point)
|
||||||
(org-babel-get-src-block-info))))
|
(org-babel-trim
|
||||||
;; optionally raise an error if named
|
(org-babel-expand-noweb-references
|
||||||
;; source-block doesn't exist
|
(org-babel-get-src-block-info))))
|
||||||
(if (member lang org-babel-noweb-error-langs)
|
;; optionally raise an error if named
|
||||||
(error "%s"
|
;; source-block doesn't exist
|
||||||
(concat
|
(if (member lang org-babel-noweb-error-langs)
|
||||||
"<<" source-name ">> "
|
(error "%s"
|
||||||
"could not be resolved (see "
|
(concat
|
||||||
"`org-babel-noweb-error-langs')"))
|
"<<" source-name ">> "
|
||||||
"")))))
|
"could not be resolved (see "
|
||||||
|
"`org-babel-noweb-error-langs')"))
|
||||||
|
""))))))
|
||||||
"[\n\r]") (concat "\n" prefix)))))
|
"[\n\r]") (concat "\n" prefix)))))
|
||||||
(nb-add (buffer-substring index (point-max)))))
|
(nb-add (buffer-substring index (point-max)))))
|
||||||
new-body))
|
new-body))
|
||||||
|
|
Loading…
Reference in New Issue