From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: a patch to ob-lisp.el Date: Sun, 27 Mar 2016 00:02:56 +0800 Message-ID: <874mbtz0pb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akIWD-0003xC-MU for emacs-orgmode@gnu.org; Sun, 27 Mar 2016 17:46:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akIWA-0006SP-GN for emacs-orgmode@gnu.org; Sun, 27 Mar 2016 17:46:45 -0400 Received: from [60.160.207.94] (port=18717 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akIW0-0006Lh-IO for emacs-orgmode@gnu.org; Sun, 27 Mar 2016 17:46:42 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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`. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=ob-lisp-patch Content-Transfer-Encoding: quoted-printable Content-Description: ob-lisp patch 1c1 < ;;; ob-lisp.el --- org-babel functions for common lisp evaluation with SL= Y or SLIME. =2D-- > ;;; ob-lisp.el --- org-babel functions for common lisp evaluation 3c3 < ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. =2D-- > ;; Copyright (C) 2009-2016 Free Software Foundation, Inc. 5,11c5,9 < ;; Authors: stardiviner < ;; Maintainer: stardiviner < ;; 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")) =2D-- > ;; Authors: Joel Boehland > ;; Eric Schulte > ;; David T. O'Toole > ;; Keywords: literate programming, reproducible research > ;; Homepage: http://orgmode.org 30c28 < ;;; Support for evaluating Common Lisp code, relies on SLY or SLIME for a= ll eval. =2D-- > ;;; 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/ =2D-- > ;; 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) <=20 <=20 < ;; (declare-function sly-eval "ext:sly" (sexp &optional package)) =2D-- > (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 v= ar))) < vars "\n ") < ")\n" body ")") < body)))) =2D-- > (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) =2D-- > (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))) =2D-- > "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-fm= t dir) < "(progn %s\n)") < (buffer-substring-no-properties < (point-min) (point-max))))) < (cdr (assoc :package params))))))) =2D-- > (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))) =2D-- > (cdr (assoc :colnames params))) 117c101 < (cdr (assoc :rownames params))))) =2D-- > (cdr (assoc :rownames params))))) --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJW9rKxAAoJEBtd8cla6JrD3A0IANXxQ/7B0KQ0eqyccW5JPDkt kmaU7Qxn9w0t9iNaAl3vDZCY/Y+2H3/GN6boqByAKk4fIZ9/yZm8gJyD+WoXy2WW KtDHIFlKUACi2mgLQuMSoy3Lqig/9frMV0idTaJ5r6rwaJoOI0uZL/9svtzATT2d crOaWT/X2hpR7hfAcVMcESHK/K97HE0dqiqA/uUvxT7s2JPX/HfDsL20G1ZTEoti q4aSPt7KfzV7QxPqAbIWoxAViSY87b5NohREZ6B5xUWQAbd1r7uFsww6IW2vO+ue 12/C4zSQN19kzW1fT1dPOXOBFxsx3hXzybBtCnrr23wF9kHOQrhAHT6OoOS3FAQ= =agtq -----END PGP SIGNATURE----- --==-=-=--