~bzg/org-mode

d1c6f91ced9690eeb95a0c83e2a8683086caea93 — Ihor Radchenko a month ago 029d85d
lisp/ob-emacs-lisp.el: Throw an error when session is requested

* lisp/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): When :session
is provided, signal error - sessions are not supported.
(org-babel-prep-session:emacs-lisp): Signal error when trying to
switch to session.

Reported-by: Adam Sneller <adam@earth2adam.com>
Link: https://orgmode.org/list/871qoe8k9e.fsf@localhost
1 files changed, 6 insertions(+), 0 deletions(-)

M lisp/ob-emacs-lisp.el
M lisp/ob-emacs-lisp.el => lisp/ob-emacs-lisp.el +6 -0
@@ 69,6 69,7 @@ by `org-edit-src-code'.")
(defun org-babel-execute:emacs-lisp (body params)
  "Execute emacs-lisp code BODY according to PARAMS."
  (let* ((lexical (cdr (assq :lexical params)))
         (session (cdr (assq :session params)))
	 (result-params (cdr (assq :result-params params)))
	 (body (format (if (member "output" result-params)
			   "(with-output-to-string %s\n)"


@@ 79,6 80,7 @@ by `org-edit-src-code'.")
				 (concat "(pp " body ")")
			       body))
		       (org-babel-emacs-lisp-lexical lexical))))
    (when session (error "ob-emacs-lisp backend does not support sessions"))
    (org-babel-result-cond result-params
      (let ((print-level nil)
            (print-length nil))


@@ 111,6 113,10 @@ channel, as returned by `org-babel-get-src-block-info'."
         (org-babel-read
          (cdr (assq :lexical (nth 2 info)))))))

(defun org-babel-prep-session:emacs-lisp (_session _params)
  "Return an error because we do not support sessions."
  (error "ob-emacs-lisp backend does not support sessions"))

(org-babel-make-language-alias "elisp" "emacs-lisp")

(provide 'ob-emacs-lisp)