emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo Alekseyev <dnquark@gmail.com>
To: Eric Schulte <eric.schulte@gmx.com>
Cc: Emacs orgmode <emacs-orgmode@gnu.org>
Subject: Re: [bugs] Export to HTML requires issuing org-babel-execute-buffer; results replace fails
Date: Mon, 23 Jan 2012 22:53:42 -0600	[thread overview]
Message-ID: <CADzxs1=8UROBjprc5aKhyOfUXA4utD1TjaNSMzVCJ2wGXESXoQ@mail.gmail.com> (raw)
In-Reply-To: <87d3a9n3rs.fsf@gmx.com>

On Mon, Jan 23, 2012 at 10:05 PM, Eric Schulte <eric.schulte@gmx.com> wrote:
> Leo Alekseyev <dnquark@gmail.com> writes:
>
>> On Mon, Jan 23, 2012 at 11:58 AM, Eric Schulte <eric.schulte@gmx.com> wrote:
>>> Leo Alekseyev <dnquark@gmail.com> writes:
>>>
>>>> Since all source blocks are evaluated on export, I don't think it
>>>> should be necessary to issue org-babel-execute-buffer before invoking
>>>> export.  However, running HTML export without org-babel-execute-buffer
>>>> currently produces garbage output.
>>>>
>>>
>>> What do you mean by "garbage" output?
>>
>> That wasn't a very good description, sorry.
>
> No problem, thanks for clarifying.
>
> [... moot bug removed ...]
>
>>>
>>> Could you isolate a minimal example demonstrating just the failure of
>>> results replacement?
>>
>> Run the below code a few times with C-c C-v b, and you'll see
>>
>> ------------snip---------
>> #+property: session *R-babel*
>>
>> #+NAME: foo
>> #+HEADER: :var plot.filename="conv1.png"
>> #+BEGIN_SRC R :results output silent
>>   cat.fname.link <- function() { cat(plot.filename,"\n",sep="") }
>>   cat.fname.link()
>> #+END_SRC
>>
>> src_R[:results output replace]{ cat.fname.link() }
>> ------------snip---------
>>
>>
>> You can also replace src_R with
>>
>> #+begin_src R :results output raw replace :exports results
>>  cat.fname.link()
>> #+end_src
>>
>> and it will also fail to replace results.
>>
>> All the above examples were run with the latest pull of org.
>>
>
> Ah, I see now.  Unfortunately it is not possible to replace the results
> of inline code blocks.  This is because there is no general way to
> identify where the results begin and end.  Maybe adding [:results
> silent] to your inline code blocks would solve the problem.  Then you
> could evaluate the whole buffer, and could previews the values produced,
> but would not have to worry about duplicate results.

Yes, that's a good suggestion.

Just to be clear, do you consider the following to be an inline block?
 (I usually think of inline as limited to src_R{ ...} type things).
Or are you generally talking about the distinction between #+begin_src
/ #+end_src lines vs #+call lines?

#+begin_src R :results output raw replace :exports results
 cat.fname.link()
#+end_src

Finally, in the last file of my original message I try to use #+call's
everywhere instead of source blocks.  Cleaned up example is pasted
below.  It looks broken (the first #+call bar is out of order, the
second and third #+call bar's don't run), see
http://pastebin.com/LqYK0Ps2 with my annotation where the output looks
broken

----------snip---------
#+property: session *R-babel*

#+NAME: foo
#+HEADER: :var a="a1.png"
#+BEGIN_SRC R :results output silent
  cat("in foo block\n")
  cat.a <- function() { cat(a,"\n",sep="") }
  cat.a()
#+END_SRC

#+NAME: bar
#+begin_src R :results output raw replace :exports none
 cat.a()
#+end_src


Should have all a1 stuff

#+call: foo(a="a1.png")

#+call: bar()

Should have all a2 stuff

#+call: foo(a="a2.png")

#+call: bar()

Should have all a3 stuff

#+call: foo(a="a3.png")

#+call: bar()

  reply	other threads:[~2012-01-24  4:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21  0:25 [bugs] Export to HTML requires issuing org-babel-execute-buffer; results replace fails Leo Alekseyev
2012-01-23 17:58 ` Eric Schulte
2012-01-24  3:50   ` Leo Alekseyev
2012-01-24  4:05     ` Eric Schulte
2012-01-24  4:53       ` Leo Alekseyev [this message]
2012-01-24 14:52         ` Eric Schulte
2012-01-24 23:35           ` Leo Alekseyev
2012-01-27 22:43             ` Eric Schulte
2012-01-28 23:07               ` Leo Alekseyev

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='CADzxs1=8UROBjprc5aKhyOfUXA4utD1TjaNSMzVCJ2wGXESXoQ@mail.gmail.com' \
    --to=dnquark@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.schulte@gmx.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).