From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [Orgmode] [babel] some lisp/slime progress Date: Thu, 31 Mar 2011 00:14:15 -0600 Message-ID: <8762qzq0js.fsf@gmail.com> References: <4D61CC7E.7030109@ccbr.umn.edu> <4D61CDE7.3030404@ccbr.umn.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=45439 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5B9D-0004zV-Ml for Emacs-orgmode@gnu.org; Thu, 31 Mar 2011 02:14:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5B9C-0000Rm-F1 for Emacs-orgmode@gnu.org; Thu, 31 Mar 2011 02:14:23 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:60298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5B9C-0000Ri-7G for Emacs-orgmode@gnu.org; Thu, 31 Mar 2011 02:14:22 -0400 Received: by iyf13 with SMTP id 13so2656976iyf.0 for ; Wed, 30 Mar 2011 23:14:21 -0700 (PDT) In-Reply-To: <4D61CDE7.3030404@ccbr.umn.edu> (Erik Iverson's message of "Sun, 20 Feb 2011 20:28:55 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Erik Iverson Cc: Emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Erik, I've had an opportunity to return to Babel support for common lisp recently. I just copied over the existing ob-clojure.el file to ob-lisp.el and changed the clojure/swank specific parts. The resulting file seems to work after some initial tests and is exceedingly simple. If this works for you as well, then I'd propose replacing the existing ob-lisp.el with this new implementation. Please let me know what you think. Thanks -- Eric --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=ob-lisp.el Content-Transfer-Encoding: quoted-printable ;;; ob-lisp.el --- org-babel functions for common lisp evaluation ;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. ;; Author: Joel Boehland, Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 7.5 ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;;; support for evaluating common lisp code, relies on slime for all eval ;;; Code: (require 'ob) (declare-function slime-eval "ext:slime" (sexp &optional package)) (add-to-list 'org-babel-tangle-lang-exts '("lisp" . "lisp")) (defvar org-babel-default-header-args:lisp '()) (defvar org-babel-header-arg-names:lisp '(package)) (defun org-babel-expand-body:lisp (body params) "Expand BODY according to PARAMS, return the expanded body." (let* ((vars (mapcar #'cdr (org-babel-get-header params :var))) (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 ")") (format "(progn %s)" body))))) (if (or (member "code" result-params) (member "pp" result-params)) (format "(pprint %s)" body) body))) (defun org-babel-execute:lisp (body params) "Execute a block of Common Lisp code with Babel." (require 'slime) (with-temp-buffer (insert (org-babel-expand-body:lisp body params)) ((lambda (result) (read (cadr result))) (slime-eval `(swank:eval-and-grab-output ,(buffer-substring-no-properties (point-min) (point-max))))))) (provide 'ob-lisp) ;; arch-tag: 18086168-009f-4947-bbb5-3532375d851d ;;; ob-lisp.el ends here --=-=-= Content-Type: text/plain Erik Iverson writes: >> Then, things like the following work, where I assume you've already >> started M-x slime. >> >> #+begin_src emacs-lisp :session >> >> (defvar test1 "test1 value") >> (defvar test2 "test2 value") >> test2 >> >> #+end_src >> >> #+results: >> : test2 value > > Er, not emacs-lisp, just lisp... like the following > > #+begin_src lisp :session > > (defvar test1 "test1 value") > (defvar test2 "test2 value") > test2 > > #+end_src > > #+results: > : test2 value > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--