emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Results with #+begin_example/#+end_example don't get overwritten


From: Kaushal Modi
Subject: [O] Results with #+begin_example/#+end_example don't get overwritten
Date: Tue, 28 Nov 2017 21:58:31 +0000

Hello,

This issue is at the opposite spectrum of the previous issue where the Org element after #+RESULTS got overwritten..

Here's a MWE:

=====
#+TITLE: Results with #+begin_example/#+end_example do not get overwritten
#+PROPERTY: header-args:python :exports both :results output

#+BEGIN_SRC python
print('a'.islower())
print('A'.islower())
print('abc'.islower())
print('Abc'.islower())
print('aBc'.islower())
print('012'.islower())
print('{}'.islower())
print('ABC'.islower())
print('À'.islower())
print('à'.islower())
#+END_SRC
=====

With point on the src block, hit C-c C-c; you will get:

=====
#+TITLE: Results with #+begin_example/#+end_example do not get overwritten
#+PROPERTY: header-args:python :exports both :results output

#+BEGIN_SRC python
print('a'.islower())
print('A'.islower())
print('abc'.islower())
print('Abc'.islower())
print('aBc'.islower())
print('012'.islower())
print('{}'.islower())
print('ABC'.islower())
print('À'.islower())
print('à'.islower())
#+END_SRC

#+RESULTS:
#+begin_example
True
False
True
False
False
False
False
False
False
True
#+end_example
=====

But doing C-c C-c again will now give:

=====
#+TITLE: Results with #+begin_example/#+end_example do not get overwritten
#+PROPERTY: header-args:python :exports both :results output

#+BEGIN_SRC python
print('a'.islower())
print('A'.islower())
print('abc'.islower())
print('Abc'.islower())
print('aBc'.islower())
print('012'.islower())
print('{}'.islower())
print('ABC'.islower())
print('À'.islower())
print('à'.islower())
#+END_SRC

#+RESULTS:
#+begin_example
True
False
True
False
False
False
False
False
False
True
#+end_example
#+begin_example
True
False
True
False
False
False
False
False
False
True
#+end_example
=====

I think that this behavior is on a safe side and good, but there needs to be a way for Org to figure out if the stuff following #+RESULTS is safe to delete..

Can be probably have #+begin_results and #+end_results instead of #+begin_example and #+end_example? And then process the begin_results/end_results elements the same as example elements?

That way, we can safely delete/overwrite the begin_results/end_results blocks.

In the above example, Org cannot know if that example block is babel generated or user-typed.

WDYT?


--

Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]