From 945d7d25a63077bae18c656768939f292b52bb44 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Tue, 25 Jun 2013 21:51:07 +0200 Subject: [PATCH] ob-core: insert results at the point of call * lisp/ob-core.el (org-babel-execute-src-block): Ensure that head is set to location of call if it is known. Pass through head to `org-babel-find-named-result' so that it doesn't search from the beginning of the file. --- lisp/ob-core.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 4115912..36f42e1 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -662,8 +662,8 @@ (defun org-babel-execute-src-block (&optional arg info params) (when (cdr (assoc :file params)) (setq result-params (remove "file" result-params))))) - (org-babel-insert-result - result result-params info new-hash indent lang)) + (org-babel-insert-result + result result-params info new-hash indent lang)) (run-hooks 'org-babel-after-execute-hook) result) (setq call-process-region @@ -1839,7 +1839,11 @@ (defun org-babel-where-is-src-block-result (&optional insert info hash indent) ;; - return t if it is found, else return nil ;; - if it does not need to be rebuilt, then don't set end ;; - if it does need to be rebuilt then do set end - name (setq beg (org-babel-find-named-result name)) + name (setq beg (org-babel-find-named-result + name + (or org-babel-current-src-block-location + (nth 6 info) + (org-babel-where-is-src-block-head)))) (prog1 beg (when (and hash (not (string= hash (match-string 5)))) (goto-char beg) (setq end beg) ;; beginning of result -- 1.8.3.1