From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [babel] automatically add debugging output Date: Sat, 03 Nov 2012 18:52:23 -0600 Message-ID: <874nl6w5o8.fsf@gmail.com> References: <87bofeb4mx.fsf@med.uni-goettingen.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUoS0-0000ay-Sm for emacs-orgmode@gnu.org; Sat, 03 Nov 2012 20:52:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUoRz-0004rA-JN for emacs-orgmode@gnu.org; Sat, 03 Nov 2012 20:52:32 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:64972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUoRz-0004r6-Ev for emacs-orgmode@gnu.org; Sat, 03 Nov 2012 20:52:31 -0400 Received: by mail-ie0-f169.google.com with SMTP id 10so7975957ied.0 for ; Sat, 03 Nov 2012 17:52:30 -0700 (PDT) In-Reply-To: <87bofeb4mx.fsf@med.uni-goettingen.de> (Andreas Leha's message of "Sun, 04 Nov 2012 01:20:22 +0100") 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: Andreas Leha Cc: emacs-orgmode@gnu.org Andreas Leha writes: > Hi all, > > is it possible to have babel add debugging lines during execution? > > Consider this example with an enabled debug property: > #+PROPERTY: session *R* > #+PROPERTY: debug yes > > * Some code blocks > #+name: codeA > #+begin_src R > sum(1) > #+end_src > > #+name: codeB > #+begin_src R > sum(2) > #+end_src > > When executing the subtree with C-c C-v s, for example, I'd like babel to > automatically add some print() statements, so that executed is > ,---- > | print("entering codeA") > | sum(1) > | print("leaving codeA") > | > | print("entering codeB") > | sum(2) > | print("leaving codeB") > `---- > > As there is a print statement in most languages, this should be possible > quite universal for any language. > > > > Also handy would be the insertion of breakpoints > (maybe #+PROPERTY: interactive-debug yes) > In R that would lead to the execution of: > ,---- > | browser() > | sum(1) > | > | browser() > | sum(2) > `---- > > > Are these things possible? Certainly, I'd pick a language you care about (I'm guessing python), and take a shot at an implementation for that language. If this proves useful then these header arguments can be ported to other languages as there is demand and developer time supply. > > (Or better question: How are these things possible?) > Take a look at the ob-python.el. Find where `org-babel-expand-body:generic' is called, you will want to replace these calls with `org-babel-expand-body:python' and then write this new function s.t. it calls `org-babel-expand-body:generic' and does the optional debug wrapping if the debug param is present. As you said this should be fairly straightforward. If you do plan to add this feature please be prepared to write some documentation too. :) Thanks! > > > Regards, > Andreas > > -- Eric Schulte http://cs.unm.edu/~eschulte