emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Unwanted "(progn )" when Tangling Lisp Code


From: Mark Cox
Subject: [O] Unwanted "(progn )" when Tangling Lisp Code
Date: Tue, 31 May 2011 11:39:38 +1000

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]