branch: externals/org
commit c70a422082eca3545adc73ba4905360bb6d371b7
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    org-babel-execute-src-block: Ensure that buffer is not changed
    
    * lisp/ob-core.el (org-babel-execute-src-block): Ensure that we insert
    results into the buffer where the src block is located.  Even when the
    execution yields changing current buffer.
    
    Reported-by: John Kitchin <jkitc...@andrew.cmu.edu>
    Link: 
https://orgmode.org/list/caj51etqmbqihy+w3cz+etspzvb1ihbx6v+nqszkojn6jf8z...@mail.gmail.com
---
 lisp/ob-core.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 518831ec69..a2550f269a 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -805,7 +805,7 @@ guess will be made."
                          (format "at position %d" (nth 5 info)))))
            (setq exec-start-time (current-time)
                   result
-                 (let ((r (funcall cmd body params)))
+                 (let ((r (save-current-buffer (funcall cmd body params))))
                    (if (and (eq (cdr (assq :result-type params)) 'value)
                             (or (member "vector" result-params)
                                 (member "table" result-params))

Reply via email to