From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] some lisp/slime progress Date: Mon, 21 Feb 2011 10:02:05 -0700 Message-ID: <87ipwd5msk.fsf@gmail.com> References: <4D61CC7E.7030109@ccbr.umn.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=47203 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrZPM-0006n5-3Y for Emacs-orgmode@gnu.org; Mon, 21 Feb 2011 12:18:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrZP1-00050b-EK for Emacs-orgmode@gnu.org; Mon, 21 Feb 2011 12:18:28 -0500 Received: from mail-gw0-f43.google.com ([74.125.83.43]:62245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrZP1-00050Q-BN for Emacs-orgmode@gnu.org; Mon, 21 Feb 2011 12:18:27 -0500 Received: by gwb11 with SMTP id 11so268690gwb.30 for ; Mon, 21 Feb 2011 09:18:26 -0800 (PST) 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 Erik Iverson writes: > Hello, > > I recently posted on the inability of ob-lisp.el to > submit multiple forms to a running CL session and return > the result. > > http://permalink.gmane.org/gmane.emacs.orgmode/37325 > > I have made some progress in fixing this, but it *required > defining a new function in SLIME, so I do not post this > as a patch to org-mode, since it depends on more than > org-mode*. I don't know if this is something that truly > belongs in SLIME, so I may follow-up on that mailing list. > It looks like you've inserted an orgmode specific function into slime? Maybe your slime patch could be changed to the introduction of a new hook to which this org-mode specific function could be bound? I imagine the slime mailing list would know the best solution here. > > NB: this only works when :session is specified. > I think it is reasonable for the :session header argument to be added to an `org-babel-default-header-args:lisp' variable defined in ob-lisp. That would remove the need to constantly specify :session. This is similar to the ob-clojure approach, which by default always uses a slime session. > > In SLIME swank.lisp, I define: > > (defslimefun interactive-eval-region-orgmode (string) > (with-buffer-syntax () > (with-retry-restart (:msg "Retry SLIME interactive evaluation request.") > (list (format nil "~{~S~^~%~}" (eval-region string)))))) > > > Then, in ob-lisp.el, apply the following patch. > > diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el > index 600b79e..2980cc8 100644 > --- a/lisp/ob-lisp.el > +++ b/lisp/ob-lisp.el > @@ -78,7 +78,11 @@ This function is called by `org-babel-execute-src-block'" > (if session > ;; session evaluation > (save-window-excursion > - (cadr (slime-eval `(swank:eval-and-grab-output ,full-body)))) > + (with-temp-buffer > + (insert full-body) > + (slime-eval > + `(swank:interactive-eval-region-orgmode > + ,(buffer-substring-no-properties (point-min) (point-max)))))) > ;; external evaluation > (let ((script-file (org-babel-temp-file "lisp-script-"))) > (with-temp-file script-file > > 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 > Great, I look forward to playing with this as soon as I find some time... Thanks for sharing -- Eric > > > Best Regards, > --Erik Iverson