* [babel] Multiple results blocks for the same source code
@ 2011-09-23 12:11 Sebastien Vauban
2011-09-23 15:53 ` Eric Schulte
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2011-09-23 12:11 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
#+TITLE: Multiple results blocks for the same source code
#+AUTHOR: Seb Vauban
#+DATE: 2011-09-23
#+LANGUAGE: en
* Bug
When evaluating multiple times the following code, we get multiple =results=
blocks.
#+begin_src sh
echo Hello
#+end_src
#+results:
: Hello
#+results:
: Hello
* ERT Test Case
#+begin_src emacs-lisp
(ert-deftest test-org-babel/just-one-results-block ()
"Test that evaluating two times the same code block does not result in a
duplicate results block."
(org-test-with-temp-text "#+begin_src sh\necho Hello\n#+end_src\n"
(org-babel-execute-src-block)
(org-babel-execute-src-block) ;; second code block execution
;; where is point (supposed to be)?
(goto-char (point-min))
(should (search-forward "Hello")) ;; the string inside the source code block
(should (search-forward "Hello")) ;; the same string in the (first?) results block
(should-error (search-forward "Hello"))))
#+end_src
* Extra context
This problem appeared after having executed sh code blocks (calling Ledger)
which failed -- for some reason still to be studied.
After an Emacs restart, I can't reproduce this anymore. So, not really fixed,
but not there systematically either...
Status is unreproducible right now, but I guess the above test case can
already be added. Please comment on it, for me to progress...
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel] Multiple results blocks for the same source code
2011-09-23 12:11 [babel] Multiple results blocks for the same source code Sebastien Vauban
@ 2011-09-23 15:53 ` Eric Schulte
2011-09-23 21:44 ` Sebastien Vauban
0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2011-09-23 15:53 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
Hi Seb,
I could not reproduce the error you describe, and your test case passes
for me. I have added your test case to testing/test-ob.el however so it
should protect from this error in the future.
You could try running the test suite in batch mode (which will not load
your configuration) and see if the test still fails for you. If not
then the problem is probably due to either something in your config.
Thanks for the test case! -- Eric
ps. the only comments I have on the test itself are
1. The initial placement of the point is described in the
documentation string for the `org-test-with-temp-text' function
2. In the future if you could share new test cases as patches to the
relevant test file (i.e., using git format-patch) that would be
ideal
"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
> #+TITLE: Multiple results blocks for the same source code
> #+AUTHOR: Seb Vauban
> #+DATE: 2011-09-23
> #+LANGUAGE: en
>
> * Bug
>
> When evaluating multiple times the following code, we get multiple =results=
> blocks.
>
> #+begin_src sh
> echo Hello
> #+end_src
>
> #+results:
> : Hello
>
> #+results:
> : Hello
>
> * ERT Test Case
>
> #+begin_src emacs-lisp
> (ert-deftest test-org-babel/just-one-results-block ()
> "Test that evaluating two times the same code block does not result in a
> duplicate results block."
> (org-test-with-temp-text "#+begin_src sh\necho Hello\n#+end_src\n"
> (org-babel-execute-src-block)
> (org-babel-execute-src-block) ;; second code block execution
> ;; where is point (supposed to be)?
> (goto-char (point-min))
> (should (search-forward "Hello")) ;; the string inside the source code block
> (should (search-forward "Hello")) ;; the same string in the (first?) results block
> (should-error (search-forward "Hello"))))
> #+end_src
>
> * Extra context
>
> This problem appeared after having executed sh code blocks (calling Ledger)
> which failed -- for some reason still to be studied.
>
> After an Emacs restart, I can't reproduce this anymore. So, not really fixed,
> but not there systematically either...
>
> Status is unreproducible right now, but I guess the above test case can
> already be added. Please comment on it, for me to progress...
>
> Best regards,
> Seb
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel] Multiple results blocks for the same source code
2011-09-23 15:53 ` Eric Schulte
@ 2011-09-23 21:44 ` Sebastien Vauban
2011-09-23 21:51 ` Eric Schulte
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2011-09-23 21:44 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Eric Schulte wrote:
> I could not reproduce the error you describe, and your test case passes
> for me. I have added your test case to testing/test-ob.el however so it
> should protect from this error in the future.
I can't reproduce it anymore right now. But the goal was to have a fuse
against that for the future, yes.
> You could try running the test suite in batch mode (which will not load
> your configuration) and see if the test still fails for you. If not
> then the problem is probably due to either something in your config.
When I get back in a "broken" config such as the one described here, I'll do
it.
> Thanks for the test case! -- Eric
>
> ps. the only comments I have on the test itself are
> 1. The initial placement of the point is described in the
> documentation string for the `org-test-with-temp-text' function
That's very clear, yes, but for the case where we don't have the string
"<point>" in the initial text. Is point at the end of the string, then? I
guess so.
But my question was more about...
>> (org-babel-execute-src-block) ;; second code block execution
>> ;; where is point (supposed to be)?
... the position of point after `org-babel-execute-src-block'.
> 2. In the future if you could share new test cases as patches to the
> relevant test file (i.e., using git format-patch) that would be
> ideal
That was my intention, after receiving a "nihil obstat" from you, or some
suggestions for changes.
Anyway, next time, I'll directly send a properly formatted patch.
Thanks.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel] Multiple results blocks for the same source code
2011-09-23 21:44 ` Sebastien Vauban
@ 2011-09-23 21:51 ` Eric Schulte
0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2011-09-23 21:51 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> Eric Schulte wrote:
>> I could not reproduce the error you describe, and your test case passes
>> for me. I have added your test case to testing/test-ob.el however so it
>> should protect from this error in the future.
>
> I can't reproduce it anymore right now. But the goal was to have a fuse
> against that for the future, yes.
>
>> You could try running the test suite in batch mode (which will not load
>> your configuration) and see if the test still fails for you. If not
>> then the problem is probably due to either something in your config.
>
> When I get back in a "broken" config such as the one described here, I'll do
> it.
>
>> Thanks for the test case! -- Eric
>>
>> ps. the only comments I have on the test itself are
>> 1. The initial placement of the point is described in the
>> documentation string for the `org-test-with-temp-text' function
>
> That's very clear, yes, but for the case where we don't have the string
> "<point>" in the initial text. Is point at the end of the string, then? I
> guess so.
>
Oh, I see I didn't address that in the function documentation. In the
case of no explicit "<point>" marker the point is placed at the
beginning of the inserted text (which also happens to be the very
beginning of the buffer).
>
> But my question was more about...
>
>>> (org-babel-execute-src-block) ;; second code block execution
>>> ;; where is point (supposed to be)?
>
> ... the position of point after `org-babel-execute-src-block'.
>
The point should remain wherever it was before executing the code block.
>
>> 2. In the future if you could share new test cases as patches to the
>> relevant test file (i.e., using git format-patch) that would be
>> ideal
>
> That was my intention, after receiving a "nihil obstat" from you, or some
> suggestions for changes.
>
> Anyway, next time, I'll directly send a properly formatted patch.
>
Wonderful. Thanks again -- Eric
>
> Thanks.
>
> Best regards,
> Seb
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-23 21:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-23 12:11 [babel] Multiple results blocks for the same source code Sebastien Vauban
2011-09-23 15:53 ` Eric Schulte
2011-09-23 21:44 ` Sebastien Vauban
2011-09-23 21:51 ` Eric Schulte
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).