update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; ob-emacs-lisp.el --- Babel Functions for Emacs-lisp Code -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Eric Schulte
|
||||
;; Keywords: literate programming, reproducible research
|
||||
@@ -53,18 +53,23 @@ by `org-edit-src-code'.")
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
(let ((vars (org-babel--get-vars params))
|
||||
(print-level nil)
|
||||
(print-length nil))
|
||||
(print-length nil)
|
||||
(prologue (cdr (assq :prologue params)))
|
||||
(epilogue (cdr (assq :epilogue params))))
|
||||
(if (null vars) (concat body "\n")
|
||||
(format "(let (%s)\n%s\n)"
|
||||
(format "(let (%s)\n%s%s%s\n)"
|
||||
(mapconcat
|
||||
(lambda (var)
|
||||
(format "%S" `(,(car var) ',(cdr var))))
|
||||
vars "\n ")
|
||||
body))))
|
||||
(if prologue (concat prologue "\n ") "")
|
||||
body
|
||||
(if epilogue (concat "\n " epilogue "\n") "")))))
|
||||
|
||||
(defun org-babel-execute:emacs-lisp (body params)
|
||||
"Execute a block of emacs-lisp code with Babel."
|
||||
"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)"
|
||||
@@ -72,9 +77,11 @@ by `org-edit-src-code'.")
|
||||
(org-babel-expand-body:emacs-lisp body params)))
|
||||
(result (eval (read (if (or (member "code" result-params)
|
||||
(member "pp" result-params))
|
||||
(concat "(pp " body ")")
|
||||
(concat "(pp-to-string " body ")")
|
||||
body))
|
||||
(org-babel-emacs-lisp-lexical lexical))))
|
||||
(when (and session (not (equal session "none")))
|
||||
(error "ob-emacs-lisp backend does not support sessions"))
|
||||
(org-babel-result-cond result-params
|
||||
(let ((print-level nil)
|
||||
(print-length nil))
|
||||
@@ -100,12 +107,17 @@ and the LEXICAL argument to `eval'."
|
||||
(defun org-babel-edit-prep:emacs-lisp (info)
|
||||
"Set `lexical-binding' in Org edit buffer.
|
||||
Set `lexical-binding' in Org edit buffer according to the
|
||||
corresponding :lexical source block argument."
|
||||
corresponding :lexical source block argument provide in the INFO
|
||||
channel, as returned by `org-babel-get-src-block-info'."
|
||||
(setq lexical-binding
|
||||
(org-babel-emacs-lisp-lexical
|
||||
(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)
|
||||
|
||||
Reference in New Issue
Block a user