From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [babel] howto debug #+call lines Date: Tue, 09 Oct 2012 18:15:04 +0200 Message-ID: <87ipajsjuf.fsf@med.uni-goettingen.de> References: <87pq4ztgkg.fsf@med.uni-goettingen.de> <87pq4x8www.fsf@gmx.com> <87k3v4tyqk.fsf@med.uni-goettingen.de> <87obkf14c8.fsf@gmx.com> <87vcelrvju.fsf@med.uni-goettingen.de> <877gr0wf3r.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLcT3-0001TT-Pa for emacs-orgmode@gnu.org; Tue, 09 Oct 2012 12:16:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLcSn-0000MB-8i for emacs-orgmode@gnu.org; Tue, 09 Oct 2012 12:15:37 -0400 Received: from plane.gmane.org ([80.91.229.3]:60853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLcSm-0000K2-Tn for emacs-orgmode@gnu.org; Tue, 09 Oct 2012 12:15:21 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TLcSo-00089H-HH for emacs-orgmode@gnu.org; Tue, 09 Oct 2012 18:15:22 +0200 Received: from genepi110.genepi.med.uni-goettingen.de ([134.76.140.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Oct 2012 18:15:22 +0200 Received: from andreas.leha by genepi110.genepi.med.uni-goettingen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Oct 2012 18:15:22 +0200 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: emacs-orgmode@gnu.org Eric Schulte writes: > Andreas Leha writes: > >> Hi Eric, >> >> >>> Andreas Leha writes: >>> >>>> Hi Eric, >>>> >>>>> Andreas Leha writes: >>>>> >>>>>> Hi all, >>>>>> >>>>>> I am getting different results from the evaluation of a source block and >>>>>> the evaluation of a #+call line to that block. >>>>>> >>>>>> Therefore, my question: Is there an equivalent to >>>>>> org-babel-expand-src-block (C-c C-v v) for #+call lines? >>>>>> >>>>>> Or more general: How do I debug #+call lines? >>>>>> >>>>>> Regards, >>>>>> Andreas >>>>>> >>>>> >>>>> Can you provide a minimal example? >>>>> >>>>> You could write a code block equivalent to the call line. E.g., >>>>> >>>>> #+call: foo(bar=1) >>>>> >>>>> is equivalent to >>>>> >>>>> #+begin_src emacs-lisp :var results=foo(bar=1) >>>>> results >>>>> #+end_src >>>> >>>> Thanks for following this up. I found the problem in my case: The >>>> header argument ':colnames yes' was missing from the call line, such that >>>> the passed variables were different. (I've fallen into that trap >>>> repeatedly, but do not learn, as it seems...) >>>> >>>> It would have been a lot easier to find this, if I had had the possibility >>>> to do C-c C-v v on the call line to get the chance to step through the >>>> (R-) code that is evaluated. Without this, it took me some time to >>>> figure things out. >>>> >>>> So the question still stands: Is there the possibility to see what is >>>> actually executed with a call line, similar to C-c C-v v on a source >>>> block? >>>> >>> >>> There is no body to expand in a call line so C-c C-v v would have >>> nothing to show. You can however jump to the related code block and >>> call C-c C-v v there. This process could be made faster by wrapping the >>> org-babel-goto-named-src-block and org-babel-expand-src-block functions >>> into a single function. >>> >>> >>>> >>>> For a small example consider: >>>> >>>> --- >>>> #+name: foo >>>> | bar | >>>> | baz | >>>> | bam | >>>> >>>> #+call: testblock[:var a=foo]() :colnames yes >>>> >>>> #+name: testblock >>>> #+begin_src R :var a=foo :colnames yes >>>> a <- a[,1] >>>> data.frame(x=a) >>>> #+end_src >>>> --- >>>> >>>> Regards, >>>> Andreas >>>> >>>> >> >> Thanks for the confirmation, that there is no possibility to expand a >> #+call line. >> >> I know, that I can jump to the code block and expand that one (quite >> fast with C-c C-v g RET C-c C-v v), but that is exactly *not* what I was >> looking for. Because then, the header arguments to the source code >> block will apply instead of the header arguments to the #+call line. >> >> I was hoping for a C-c C-v v on #+call lines, which would spare me from >> modifying the source block's header arguments. But it is not a pressing >> issue, just my laziness (and bad coding perhaps). >> > > Patches are always welcome. :) That's plagiarism. You should cite Bastien here :) > > The call line is evaluated by first expanding itself into a full code > block, so perhaps you could add functionality to C-c C-v v so that it > will expand this ephemeral code block. Additionally it may be easy to > update C-c C-v I so that it works on call lines, which may provide the > information you're after. Thanks for the pointers. Let's see whether I'll find time. Should not be hard even with my elisp "skills". Regards, Andreas