emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Results with #+begin_example/#+end_example don't get overwritten
Date: Tue, 28 Nov 2017 21:58:31 +0000	[thread overview]
Message-ID: <CAFyQvY3vUbaxUVyNoXg7VaTnumULkKj8TSpZ-f65PG5A_GxAvg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2402 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3180 bytes --]

             reply	other threads:[~2017-11-28 21:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 21:58 Kaushal Modi [this message]
2017-11-28 22:07 ` Results with #+begin_example/#+end_example don't get overwritten Kaushal Modi
2017-11-28 22:36   ` Nicolas Goaziou
2017-11-28 22:45     ` Kaushal Modi
2017-11-28 23:16       ` Nicolas Goaziou
2017-11-28 23:24         ` Kaushal Modi
2017-11-29 18:10           ` Nicolas Goaziou

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=CAFyQvY3vUbaxUVyNoXg7VaTnumULkKj8TSpZ-f65PG5A_GxAvg@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).