From: Ihor Radchenko <yantar92@gmail.com>
To: Greg Minshall <minshall@umich.edu>
Cc: emacs-orgmode@gnu.org
Subject: [FR, DISCUSSION] Re: [:results append] and [:wrap ...] don't play well together
Date: Fri, 05 Aug 2022 13:59:56 +0800 [thread overview]
Message-ID: <87tu6rnsbn.fsf@localhost> (raw)
In-Reply-To: <327595.1617159365@apollo2.minshall.org>
Greg Minshall <minshall@umich.edu> writes:
> hi. this fails with [emacs -Q], which in my case
> : Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)
>
> and, also in whatever elpa'ish version i'm running
> : Org mode version 9.4.4 (release_9.4.4-277-g2e1c98 @ /home/minshall/.emacs.d/straight/build/org/)
>
> when i specify [:results append] and also [:wrap foo], the results are
> not obviously appended. below it seems as if the second evaluation is
> appended, then the following are prepended after the first one?
I am replying late, but let's have an explanation for this issue as a
record at least.
The observed issue is not a bug, but rather a non-intuitive behaviour.
Let me explain how Org treats the described sequence of block
executions:
#+begin_src R :results append :wrap foo
Sys.time()
#+end_src
#1:
#+RESULTS:
#+begin_foo
2021-03-31 05:51:08
#+end_foo
<end of the results drawer; the result is first element after the block
with #+results keyword>
#2:
#+RESULTS:
#+begin_foo
2021-03-31 05:51:08
#+end_foo
<end of the results drawer; appending a new result>
#+begin_foo
2021-03-31 05:51:10
#+end_foo
#3:
#+RESULTS:
#+begin_foo
2021-03-31 05:51:08
#+end_foo
<end of the results drawer; appending a new result right here. The next
#drawer is _not_ considered a part of the result.>
#+begin_foo
2021-03-31 05:51:12
#+end_foo
#+begin_foo
2021-03-31 05:51:10
#+end_foo
And so on.
It is generally impossible to distinguish between a result consisting of
multiple paragraphs/drawers/other Org elements and the consequent
ordinary Org text. Consider:
#+begin_src elisp :results raw value
"paragraph 1
paragraph 2"
#+end_src
paragraph 3
Executing the above yields
#+begin_src elisp :results raw value
"paragraph 1
paragraph 2"
#+end_src
#+RESULTS:
paragraph 1
paragraph 2
paragraph 3
By looking at the #+RESULTS:, Org cannot possibly know if paragraph 2
belongs to the results or paragraph 3, or maybe just paragraph 1.
We may clarify this in the manual.
Another alternative could be treating
:results append drawer/code/pp/org/latex/html
differently and putting everything into a single drawer/src/export
environment like:
#+begin_src R :results append :wrap foo
Sys.time()
#+end_src
#3:
#+RESULTS:
#+begin_foo
2021-03-31 05:51:08
2021-03-31 05:51:10
2021-03-31 05:51:12
#+end_foo
However, changing the behaviour will be a breaking change, which we do
not want for the sake of back-compatibility.
Instead, we may introduce something like
:results append-contents drawer
that will behave like the above.
Is there a demand to have such a feature?
Best,
Ihor
next prev parent reply other threads:[~2022-08-05 6:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 2:56 [:results append] and [:wrap ...] don't play well together Greg Minshall
2022-08-05 5:59 ` Ihor Radchenko [this message]
2022-08-09 22:23 ` [FR, DISCUSSION] " Greg Minshall
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=87tu6rnsbn.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=minshall@umich.edu \
/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).