From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Don't ask, don't run Date: Mon, 11 Jul 2011 11:51:06 -0600 Message-ID: <87fwmcaeph.fsf@gmail.com> References: <87sjqg4jiq.fsf@ucl.ac.uk> <87r55yruyu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgKda-0003fi-Qj for emacs-orgmode@gnu.org; Mon, 11 Jul 2011 13:51:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgKdX-000302-2I for emacs-orgmode@gnu.org; Mon, 11 Jul 2011 13:51:18 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:39303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgKdW-0002zY-MQ for emacs-orgmode@gnu.org; Mon, 11 Jul 2011 13:51:14 -0400 Received: by pzk4 with SMTP id 4so3949933pzk.0 for ; Mon, 11 Jul 2011 10:51:12 -0700 (PDT) In-Reply-To: (Ken Williams's message of "Mon, 11 Jul 2011 15:19:38 +0000 (UTC)") 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: Ken Williams Cc: emacs-orgmode@gnu.org Ken Williams writes: > Eric Schulte gmail.com> writes: > >> There is no way to customize `org-confirm-evaluate' to achieve this >> behavior, however it can be accomplished through creative use of the >> :eval header argument, by using the `org-export-current-backend' >> variable to inhibit evaluation during export. >> >> #+begin_src emacs-lisp :eval (if org-export-current-backend "never" >> "yes") :exports results >> (message "launch missles") >> #+end_src > > I see, thanks. Since I'm new to this, can I confirm my understanding > here? It tests whether the 'org-export-current-backend' variable is > set, which means we're currently exporting, and if so, we set the > :eval argument to "never". Otherwise we set it to "yes", which means > evaluate it without asking. > > Assuming that understanding is correct, I have a couple of followup > questions. > > 1) http://orgmode.org/manual/eval.html doesn't list the "yes" option, > OK, I've just updated this documentation. There actually is no "yes" option, a more clear version of my snippet above would have set :eval to nil when not in export. Any value of :eval which is no "never" or "no" will result in the default behavior as determined by org-confirm-babel-evaluate. > > 2) Is there a similar variable I might test to check whether it's currently > doing an explicit C-c C-c action? If there were, I might prefer > something like :eval (if org-export-current-backend "never" (if > org-doing-c-c-c-c "yes" "query")), so that I cover some other > scenario besides export or C-c C-c. > hmm, I'm not sure... you could try `called-interactively-p' e.g., (if (called-interactively-p 'interactive) "yes" "query") > > 3) Finally, is there a way to add this argument fanciness implicitly > to *all* the source blocks in my file? Or will it have to go on > all of them? > Yes, place it in a #+Babel: line at the top of the file, see http://orgmode.org/manual/Using-header-arguments.html Best -- Eric > > Thanks much. > > -Ken > > -- Eric Schulte http://cs.unm.edu/~eschulte/