From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Unwanted "(progn )" when Tangling Lisp Code Date: Tue, 31 May 2011 09:57:02 -0600 Message-ID: <87y61mmk5j.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:40661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRZyU-0001qi-UR for emacs-orgmode@gnu.org; Tue, 31 May 2011 21:11:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRZyT-00025c-AV for emacs-orgmode@gnu.org; Tue, 31 May 2011 21:11:54 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:44612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRZyS-00025O-PX for emacs-orgmode@gnu.org; Tue, 31 May 2011 21:11:53 -0400 Received: by pxi2 with SMTP id 2so2966229pxi.38 for ; Tue, 31 May 2011 18:11:51 -0700 (PDT) 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: Mark Cox Cc: emacs-orgmode@gnu.org Hi Mark, Thanks for the suggestion, I've applied a modified version of your patch which moves the progn wrapping out of the expand-body function and into the evaluation function. Progn wrapping is required for blocks like the following. #+begin_src lisp :results value (format t "~&eric") (+ 1 2) #+end_src #+results: : 3 Thanks -- Eric Mark Cox writes: > Hi, > > When tangling lisp source code blocks, the tangled code is wrapped in > a `(progn ,@body). For example, > the block > #+begin_src lisp :tangle example.lisp > (defun mischief () > (/ 1 0)) > #+end_src > produces > : (progn (defun mischief () > : (/ 1 0)) > : ) > > With the attached patch, the tangling process now produces > : > : (defun mischief () > : (/ 1 0)) > > Thanks > Mark > > Here is the patch. > > diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el > index a810d86..3382418 100644 > --- a/lisp/ob-lisp.el > +++ b/lisp/ob-lisp.el > @@ -54,7 +54,7 @@ > (format "(%S (quote %S))" (car var) (cdr var))) > vars "\n ") > ")\n" body ")") > - (format "(progn %s)" body))))) > + body)))) > (if (or (member "code" result-params) > (member "pp" result-params)) > (format "(pprint %s)" body) > @@ -65,7 +65,7 @@ > (require 'slime) > (org-babel-reassemble-table > (with-temp-buffer > - (insert (org-babel-expand-body:lisp body params)) > + (insert (format "(progn\n %s)" (org-babel-expand-body:lisp body params))) > ((lambda (result) > (if (member "output" (cdr (assoc :result-params params))) > (car result) > -- Eric Schulte http://cs.unm.edu/~eschulte/