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 <yantar92@gmail.com>
https://orgmode.org/list/87tv5vt545.fsf@gmail.com
This commit is contained in:
Bastien 2020-09-07 07:37:19 +02:00
parent 69a91ba8bc
commit 81d49b5adb
1 changed files with 24 additions and 25 deletions

View File

@ -61,31 +61,30 @@ by `org-edit-src-code'.")
(defun org-babel-execute:emacs-lisp (body params) (defun org-babel-execute:emacs-lisp (body params)
"Execute a block of emacs-lisp code with Babel." "Execute a block of emacs-lisp code with Babel."
(save-window-excursion (let* ((lexical (cdr (assq :lexical params)))
(let* ((lexical (cdr (assq :lexical params))) (result-params (cdr (assq :result-params params)))
(result-params (cdr (assq :result-params params))) (body (format (if (member "output" result-params)
(body (format (if (member "output" result-params) "(with-output-to-string %s\n)"
"(with-output-to-string %s\n)" "(progn %s\n)")
"(progn %s\n)") (org-babel-expand-body:emacs-lisp body params)))
(org-babel-expand-body:emacs-lisp body params))) (result (eval (read (if (or (member "code" result-params)
(result (eval (read (if (or (member "code" result-params) (member "pp" result-params))
(member "pp" result-params)) (concat "(pp " body ")")
(concat "(pp " body ")") body))
body)) (org-babel-emacs-lisp-lexical lexical))))
(org-babel-emacs-lisp-lexical lexical)))) (org-babel-result-cond result-params
(org-babel-result-cond result-params (let ((print-level nil)
(let ((print-level nil) (print-length nil))
(print-length nil)) (if (or (member "scalar" result-params)
(if (or (member "scalar" result-params) (member "verbatim" result-params))
(member "verbatim" result-params)) (format "%S" result)
(format "%S" result) (format "%s" result)))
(format "%s" result))) (org-babel-reassemble-table
(org-babel-reassemble-table result
result (org-babel-pick-name (cdr (assq :colname-names params))
(org-babel-pick-name (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
(cdr (assq :colnames params))) (org-babel-pick-name (cdr (assq :rowname-names params))
(org-babel-pick-name (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))))
(cdr (assq :rownames params))))))))
(defun org-babel-emacs-lisp-lexical (lexical) (defun org-babel-emacs-lisp-lexical (lexical)
"Interpret :lexical source block argument. "Interpret :lexical source block argument.