emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Ken Williams <ken.williams@thomsonreuters.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Don't ask, don't run
Date: Mon, 11 Jul 2011 11:51:06 -0600	[thread overview]
Message-ID: <87fwmcaeph.fsf@gmail.com> (raw)
In-Reply-To: <loom.20110711T170419-192@post.gmane.org> (Ken Williams's message of "Mon, 11 Jul 2011 15:19:38 +0000 (UTC)")

Ken Williams <ken.williams@thomsonreuters.com> writes:

> Eric Schulte <schulte.eric <at> 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/

      reply	other threads:[~2011-07-11 17:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08 19:19 Don't ask, don't run Ken.Williams
2011-07-08 20:14 ` Eric S Fraga
2011-07-10 15:08   ` Eric Schulte
2011-07-11 15:19     ` Ken Williams
2011-07-11 17:51       ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwmcaeph.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ken.williams@thomsonreuters.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).