emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* a patch to ob-lisp.el
@ 2016-03-26 16:02 stardiviner
  2016-03-28  4:01 ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: stardiviner @ 2016-03-26 16:02 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 196 bytes --]


Here is my repo, and I also created an recipe on MELPA.

- http://gituhb.com/stardiviner/ob-lisp
- https://github.com/melpa/melpa/pull/3682

I hope to merge this patch to Org-mode `ob-lisp.el`.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: ob-lisp patch --]
[-- Type: text/x-diff, Size: 4797 bytes --]

1c1
< ;;; ob-lisp.el --- org-babel functions for common lisp evaluation with SLY or SLIME.
---
> ;;; ob-lisp.el --- org-babel functions for common lisp evaluation
3c3
< ;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
---
> ;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
5,11c5,9
< ;; Authors: stardiviner <numbchild@gmail.com>
< ;; Maintainer: stardiviner <numbchild@gmail.com>
< ;; Keywords: org babel lisp sly slime
< ;; URL: https://github.com/stardiviner/ob-lisp
< ;; Created: 1th March 2016
< ;; Version: 0.0.1
< ;; Package-Requires: ((org "8"))
---
> ;; Authors: Joel Boehland
> ;;	 Eric Schulte
> ;;	 David T. O'Toole <dto@gnu.org>
> ;; Keywords: literate programming, reproducible research
> ;; Homepage: http://orgmode.org
30c28
< ;;; Support for evaluating Common Lisp code, relies on SLY or SLIME for all eval.
---
> ;;; support for evaluating common lisp code, relies on slime for all eval
34,37c32,33
< ;; Requires SLY (Sylvester the Cat's Common Lisp IDE) and SLIME
< ;; See:
< ;; - https://github.com/capitaomorte/sly
< ;; - http://common-lisp.net/project/slime/
---
> ;; Requires SLIME (Superior Lisp Interaction Mode for Emacs.)
> ;; See http://common-lisp.net/project/slime/
42,50c38
< (defcustom org-babel-lisp-eval-fn "sly-eval"
<   "The function to be called to evaluate code on the Lisp side."
<   :group 'org-babel
<   :version "24.1"
<   :options '("sly-eval" "slime-eval")
<   :type 'stringp)
< 
< 
< ;; (declare-function sly-eval "ext:sly" (sexp &optional package))
---
> (declare-function slime-eval "ext:slime" (sexp &optional package))
70,80c58,68
<          (result-params (cdr (assoc :result-params params)))
<          (print-level nil) (print-length nil)
<          (body (org-babel-trim
<                 (if (> (length vars) 0)
<                     (concat "(let ("
<                             (mapconcat
<                              (lambda (var)
<                                (format "(%S (quote %S))" (car var) (cdr var)))
<                              vars "\n      ")
<                             ")\n" body ")")
<                   body))))
---
> 	 (result-params (cdr (assoc :result-params params)))
> 	 (print-level nil) (print-length nil)
> 	 (body (org-babel-trim
> 		(if (> (length vars) 0)
> 		    (concat "(let ("
> 			    (mapconcat
> 			     (lambda (var)
> 			       (format "(%S (quote %S))" (car var) (cdr var)))
> 			     vars "\n      ")
> 			    ")\n" body ")")
> 		  body))))
82,83c70,71
<             (member "pp" result-params))
<         (format "(pprint %s)" body)
---
> 	    (member "pp" result-params))
> 	(format "(pprint %s)" body)
86d73
< ;;;###autoload
88,91c75,76
<   "Execute a block `BODY' with `PARAMS' of Common Lisp code with Babel."
<   (pcase org-babel-lisp-eval-fn
<     ("slime-eval" (require 'slime))
<     ("sly-eval" (require 'sly)))
---
>   "Execute a block of Common Lisp code with Babel."
>   (require 'slime)
94,108c79,92
<           (funcall (if (member "output" (cdr (assoc :result-params params)))
<                        #'car #'cadr)
<                    (with-temp-buffer
<                      (insert (org-babel-expand-body:lisp body params))
<                      (funcall org-babel-lisp-eval-fn
<                               `(swank:eval-and-grab-output
<                                 ,(let ((dir (if (assoc :dir params)
<                                                 (cdr (assoc :dir params))
<                                               default-directory)))
<                                    (format
<                                     (if dir (format org-babel-lisp-dir-fmt dir)
<                                       "(progn %s\n)")
<                                     (buffer-substring-no-properties
<                                      (point-min) (point-max)))))
<                               (cdr (assoc :package params)))))))
---
> 	  (funcall (if (member "output" (cdr (assoc :result-params params)))
> 		       #'car #'cadr)
> 		   (with-temp-buffer
> 		     (insert (org-babel-expand-body:lisp body params))
> 		     (slime-eval `(swank:eval-and-grab-output
> 				   ,(let ((dir (if (assoc :dir params)
> 						   (cdr (assoc :dir params))
> 						 default-directory)))
> 				      (format
> 				       (if dir (format org-babel-lisp-dir-fmt dir)
> 					 "(progn %s\n)")
> 				       (buffer-substring-no-properties
> 					(point-min) (point-max)))))
> 				 (cdr (assoc :package params)))))))
115c99
<                         (cdr (assoc :colnames params)))
---
> 			(cdr (assoc :colnames params)))
117c101
<                         (cdr (assoc :rownames params)))))
---
> 			(cdr (assoc :rownames params)))))

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-04-10  8:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-26 16:02 a patch to ob-lisp.el stardiviner
2016-03-28  4:01 ` Nick Dokos
2016-03-30 15:30   ` numbchild
2016-03-30 16:52     ` Thomas S. Dye
2016-04-06  5:54       ` numbchild
2016-04-06  5:55         ` numbchild
2016-04-06  9:26           ` Nicolas Goaziou
2016-04-06 10:51             ` numbchild
2016-04-06 12:49               ` Nicolas Goaziou
2016-04-06 14:51                 ` numbchild
2016-04-10  8:12                   ` Nicolas Goaziou
2016-04-06  9:24         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).