From mboxrd@z Thu Jan  1 00:00:00 1970
From: Mark Cox <markcox80@gmail.com>
Subject: Unwanted "(progn )" when Tangling Lisp Code
Date: Tue, 31 May 2011 11:39:38 +1000
Message-ID: <BANLkTikGB2UGRD__jmgV9OqzuKQCOasKfA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([140.186.70.92]:47020)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <markcox80@gmail.com>) id 1QRDvo-0002XX-Ej
	for emacs-orgmode@gnu.org; Mon, 30 May 2011 21:39:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <markcox80@gmail.com>) id 1QRDvn-0008Pr-Jb
	for emacs-orgmode@gnu.org; Mon, 30 May 2011 21:39:40 -0400
Received: from mail-vw0-f41.google.com ([209.85.212.41]:54823)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <markcox80@gmail.com>) id 1QRDvn-0008O6-Gz
	for emacs-orgmode@gnu.org; Mon, 30 May 2011 21:39:39 -0400
Received: by vws4 with SMTP id 4so3931914vws.0
	for <emacs-orgmode@gnu.org>; Mon, 30 May 2011 18:39:38 -0700 (PDT)
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: </archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=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@gnu.org

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)