From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: How to override ":eval no" in call lines? Date: Mon, 9 Feb 2015 09:54:12 -0800 Message-ID: References: <86oaq02ivd.fsf@example.com> <86lhkv1aox.fsf@example.com> <86r3uln2lp.fsf@example.com> <86egpzjgb8.fsf@example.com> Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-354444527-1423504453=:436" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKsXd-0007F7-8W for emacs-orgmode@gnu.org; Mon, 09 Feb 2015 12:54:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKsXX-00063L-No for emacs-orgmode@gnu.org; Mon, 09 Feb 2015 12:54:37 -0500 Received: from iport-bcv1-out.ucsd.edu ([132.239.0.119]:56595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKsXX-000627-93 for emacs-orgmode@gnu.org; Mon, 09 Feb 2015 12:54:31 -0500 In-Reply-To: <86egpzjgb8.fsf@example.com> 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: Sebastien Vauban Cc: Org-Mode mailing list This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-354444527-1423504453=:436 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 9 Feb 2015, Sebastien Vauban wrote: > "Charles C. Berry" wrote: >> On Fri, 23 Jan 2015, Sebastien Vauban wrote: >>> "Charles C. Berry" wrote: >>>> Sebastien Vauban wrote: >>>>> In a long document, I must have ":eval no" at file level, as this >>>>> is the common setting for most code blocks. However, how do I unset >>>>> that for some call lines. >>> >>> I don't get why one has to add ":eval yes" for both types of headers >>> arguments. > > I still don't get that: why do I need to add *twice* ":eval yes", in > both the "inside header args" and the "end header args"? > > The documentation [1] states: > > ┌──── > │ END HEADER ARGUMENTS are applied to the calling instance and DO NOT > │ AFFECT EVALUATION OF THE NAMED CODE BLOCK. They affect how the > │ results are incorporated into the Org mode buffer and how the call > │ line is exported. > └──── > > If end header args don't affect the evaluation of the name code block, > why do we have to set ":eval" to "yes", then? > Because there are two evaluations to be made of a call_abc() instance or a `#BEGIN_SRC lang :var x=abc() ...' instance: 1. one of abc() 2. one of the instance. They can be made in any of the four combinations of `:eval yes' and `:eval no'. See below for an example of a src block calling another using the `:var x=abc()' idiom. >>> Moreover, I once read that when evaluating a call line, it is >>> converted into an ephemeral Emacs Lisp code block equivalent to the >>> call line (and created at the point of the call line): >>> >>> #+begin_src emacs-lisp :var result=() >>> result >>> #+end_src >>> >>> which is evaluated in place. >> >> No, like this: >> >> #+begin_src emacs-lisp :var result=[]() > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > What's that syntax? The one described for "header arguments in function > calls"? Aren't we recursive here: describing syntax equivalent to > a call via the ephemeral code block, reusing syntax for a call? > Not sure how best to answer. Maybe try out all combos to demo what happens: A simple src block: #+NAME: up #+BEGIN_SRC emacs-lisp :var x="CbA" (upcase x) #+END_SRC Eval this src block and `up' - prompted twice for evalution upon execution. Note RESULTS == 'C B A': #+BEGIN_SRC emacs-lisp :eval yes :var x=up[:eval yes](x="c b a") x #+END_SRC #+RESULTS: : C B A Do not eval this src block but eval `up' - prompted to evaluate `up' and message that evaluation is disabled appears for current src block. No RESULTS: #+BEGIN_SRC emacs-lisp :eval no :var x=up[:eval yes](x="c b a") x #+END_SRC Eval this src block and not `up' - prompted once for evaluation. Note RESULTS == 'nil', as x did not get a value assigned to it: #+BEGIN_SRC emacs-lisp :eval yes :var x=up[:eval no](x="c b a") x #+END_SRC #+RESULTS: : nil Eval neither. No prompts. No result. #+BEGIN_SRC emacs-lisp :eval no :var x=up[:eval no](x="c b a") x #+END_SRC >>> Where do fit into that picture? >> >> Either before or after the :var ... >> Maybe better to say: In this context the equivalent of is the `:eval' header for the src block, which can go anywhere on the line. The if supplied in this context seem to be ignored. HTH, Chuck --0-354444527-1423504453=:436--