emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] evaluation context in call statements


From: Achim Gratz
Subject: Re: [O] evaluation context in call statements
Date: Tue, 25 Jun 2013 21:53:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Achim Gratz writes:
> Rick Frankel writes:

Your lucky day is becoming a streak.

> Executing Call#2 will update the #+RESULTS for Call#1 (or actually the
> first matching #+RESULTS cookie in the whole document).  I'd think it
> should also start looking for the results line from the point of call.
> I don't really get why it does this, maybe Eric knows where to look.

I'd think this should fix it.

>From 945d7d25a63077bae18c656768939f292b52bb44 Mon Sep 17 00:00:00 2001
From: Achim Gratz <address@hidden>
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


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves

reply via email to

[Prev in Thread] Current Thread [Next in Thread]