1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-02-07 21:35:02 +00:00

ob-exp: Fix source blocks generated by other source blocks

* lisp/ob-exp.el (org-babel-exp--at-source): Source blocks generated
  by evaluating other source blocks may not be found in the original
  buffer.  In that case, do not move point.

Reported-by: "Berry, Charles" <ccberry@ucsd.edu>
<http://lists.gnu.org/r/emacs-orgmode/2017-12/msg00538.html>
This commit is contained in:
Nicolas Goaziou 2017-12-25 00:10:39 +01:00
parent f4ae1941c9
commit b3ddb051e6

View File

@ -58,9 +58,13 @@ returned is the value of the last form in BODY. Assume that
point is at the beginning of the Babel block."
(declare (indent 1) (debug body))
`(let ((source (get-text-property (point) 'org-reference)))
(with-current-buffer org-babel-exp-reference-buffer
;; Source blocks created during export process (e.g., by other
;; source blocks) are not referenced. In this case, do not move
;; point at all.
(with-current-buffer (if source org-babel-exp-reference-buffer
(current-buffer))
(org-with-wide-buffer
(goto-char source)
(when source (goto-char source))
,@body))))
(defun org-babel-exp-src-block ()