lisp/ob-lisp: fix `org-babel-execute:lisp' for use with Sly
* lisp/ob-lisp (org-babel-execute:lisp): by default, Sly and Slime talk with different RPC server programs with different names. Specialize the prefix of eval-and-grab-output to Slime (prefix swank:) or to Sly (prefix slynk:).
This commit is contained in:
parent
9ea50ca211
commit
e58bbded5c
|
@ -90,9 +90,12 @@ current directory string."
|
||||||
"Execute a block of Common Lisp code with Babel.
|
"Execute a block of Common Lisp code with Babel.
|
||||||
BODY is the contents of the block, as a string. PARAMS is
|
BODY is the contents of the block, as a string. PARAMS is
|
||||||
a property list containing the parameters of the block."
|
a property list containing the parameters of the block."
|
||||||
|
(let (eval-and-grab-output)
|
||||||
(pcase org-babel-lisp-eval-fn
|
(pcase org-babel-lisp-eval-fn
|
||||||
(`slime-eval (org-require-package 'slime "SLIME"))
|
(`slime-eval (org-require-package 'slime "SLIME")
|
||||||
(`sly-eval (org-require-package 'sly "SLY")))
|
(setq eval-and-grab-output 'swank:eval-and-grab-output))
|
||||||
|
(`sly-eval (org-require-package 'sly "SLY")
|
||||||
|
(setq eval-and-grab-output 'slynk:eval-and-grab-output)))
|
||||||
(org-babel-reassemble-table
|
(org-babel-reassemble-table
|
||||||
(let ((result
|
(let ((result
|
||||||
(funcall (if (member "output" (cdr (assq :result-params params)))
|
(funcall (if (member "output" (cdr (assq :result-params params)))
|
||||||
|
@ -100,7 +103,7 @@ a property list containing the parameters of the block."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert (org-babel-expand-body:lisp body params))
|
(insert (org-babel-expand-body:lisp body params))
|
||||||
(funcall org-babel-lisp-eval-fn
|
(funcall org-babel-lisp-eval-fn
|
||||||
`(swank:eval-and-grab-output
|
`(,eval-and-grab-output
|
||||||
,(let ((dir (if (assq :dir params)
|
,(let ((dir (if (assq :dir params)
|
||||||
(cdr (assq :dir params))
|
(cdr (assq :dir params))
|
||||||
default-directory)))
|
default-directory)))
|
||||||
|
@ -118,7 +121,7 @@ a property list containing the parameters of the block."
|
||||||
(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-lisp-vector-to-list (results)
|
(defun org-babel-lisp-vector-to-list (results)
|
||||||
;; TODO: better would be to replace #(...) with [...]
|
;; TODO: better would be to replace #(...) with [...]
|
||||||
|
|
Loading…
Reference in New Issue