From 81d49b5adb42de41dba966c64b8b374f4ba08857 Mon Sep 17 00:00:00 2001 From: Bastien Date: Mon, 7 Sep 2020 07:37:19 +0200 Subject: [PATCH] ob-emacs-lisp.el: Don't wrap execution within `save-window-excursion' * lisp/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): Don't wrap execution within `save-window-excursion'. Reported-by: Ihor Radchenko https://orgmode.org/list/87tv5vt545.fsf@gmail.com --- lisp/ob-emacs-lisp.el | 49 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/lisp/ob-emacs-lisp.el b/lisp/ob-emacs-lisp.el index 4150f1f35..a18038112 100644 --- a/lisp/ob-emacs-lisp.el +++ b/lisp/ob-emacs-lisp.el @@ -61,31 +61,30 @@ by `org-edit-src-code'.") (defun org-babel-execute:emacs-lisp (body params) "Execute a block of emacs-lisp code with Babel." - (save-window-excursion - (let* ((lexical (cdr (assq :lexical params))) - (result-params (cdr (assq :result-params params))) - (body (format (if (member "output" result-params) - "(with-output-to-string %s\n)" - "(progn %s\n)") - (org-babel-expand-body:emacs-lisp body params))) - (result (eval (read (if (or (member "code" result-params) - (member "pp" result-params)) - (concat "(pp " body ")") - body)) - (org-babel-emacs-lisp-lexical lexical)))) - (org-babel-result-cond result-params - (let ((print-level nil) - (print-length nil)) - (if (or (member "scalar" result-params) - (member "verbatim" result-params)) - (format "%S" result) - (format "%s" result))) - (org-babel-reassemble-table - result - (org-babel-pick-name (cdr (assq :colname-names params)) - (cdr (assq :colnames params))) - (org-babel-pick-name (cdr (assq :rowname-names params)) - (cdr (assq :rownames params)))))))) + (let* ((lexical (cdr (assq :lexical params))) + (result-params (cdr (assq :result-params params))) + (body (format (if (member "output" result-params) + "(with-output-to-string %s\n)" + "(progn %s\n)") + (org-babel-expand-body:emacs-lisp body params))) + (result (eval (read (if (or (member "code" result-params) + (member "pp" result-params)) + (concat "(pp " body ")") + body)) + (org-babel-emacs-lisp-lexical lexical)))) + (org-babel-result-cond result-params + (let ((print-level nil) + (print-length nil)) + (if (or (member "scalar" result-params) + (member "verbatim" result-params)) + (format "%S" result) + (format "%s" result))) + (org-babel-reassemble-table + result + (org-babel-pick-name (cdr (assq :colname-names params)) + (cdr (assq :colnames params))) + (org-babel-pick-name (cdr (assq :rowname-names params)) + (cdr (assq :rownames params))))))) (defun org-babel-emacs-lisp-lexical (lexical) "Interpret :lexical source block argument.