emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] src_blocks - :wrap blocks not being overwritten
@ 2018-10-24 21:29 Carlos García
  2018-10-29 16:00 ` Berry, Charles
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos García @ 2018-10-24 21:29 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi List,

The functionality of replacing blocks using ":wrap" seems to be broken.
In this email [1] from 2014, a user reported that this was working:

,----
| * A
|
| #+header: :results raw replace :wrap
| #+begin_src emacs-lisp
|   (+ 2 2)
| #+end_src
|
| #+results:
| #+BEGIN_RESULTS
| 4
| #+END_RESULTS
`----

i'm running orgmode 9.1.14 and the "BEGIN_RESULTS" blocks are not getting
overwritten. Can anybody else reproduce this problem?


Regards,
Carlos

[1]: http://lists.gnu.org/archive/html/emacs-orgmode/2014-07/msg00122.html

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] src_blocks - :wrap blocks not being overwritten
  2018-10-24 21:29 [BUG] src_blocks - :wrap blocks not being overwritten Carlos García
@ 2018-10-29 16:00 ` Berry, Charles
  2018-10-30 10:35   ` Carlos García
  0 siblings, 1 reply; 6+ messages in thread
From: Berry, Charles @ 2018-10-29 16:00 UTC (permalink / raw)
  To: Carlos García; +Cc: emacs-orgmode@gnu.org



> On Oct 24, 2018, at 2:29 PM, Carlos García <carloscg@gmail.com> wrote:
> 
> Hi List,
> 
> The functionality of replacing blocks using ":wrap" seems to be broken.
> In this email [1] from 2014, a user reported that this was working:
> 
> ,----
> | * A
> | 
> | #+header: :results raw replace :wrap
> | #+begin_src emacs-lisp 
> |   (+ 2 2)
> | #+end_src
> | 
> | #+results:
> | #+BEGIN_RESULTS
> | 4
> | #+END_RESULTS
> `----
> 
> i'm running orgmode 9.1.14 and the "BEGIN_RESULTS" blocks are not getting overwritten. Can anybody else reproduce this problem?
> 


Confirmed.  

The issue is that the #+BEGIN/END_results is a `special-block', which is not recognized in `org-babel-result-end' as a result type.

I think the fix is to add it.

If the intention is to NOT recognize special-blocks as results, then the empty :wrap needs to have some other effect, like enclosing the result in a drawer.

HTH,

Chuck


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] src_blocks - :wrap blocks not being overwritten
  2018-10-29 16:00 ` Berry, Charles
@ 2018-10-30 10:35   ` Carlos García
  2018-10-30 15:24     ` Berry, Charles
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos García @ 2018-10-30 10:35 UTC (permalink / raw)
  To: ccberry; +Cc: emacs-orgmode

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

Hi Chuck,

Thanks for looking into this. How difficult/desirable would it be to create
another block such as "wrap-block" for those blocks created with ":wrap"?
That way, the needed change would be rather elegant:

:line 2478 of ob-core.el:
| ;; Possible results types.
|      '(drawer example-block export-block fixed-width item
|       plain-list src-block table *wrap-block*)

What would the repercussions be if `special-block' is added to the list?


Regards,
Carlos


On Mon, Oct 29, 2018 at 5:01 PM Berry, Charles <ccberry@ucsd.edu> wrote:

>
>
> > On Oct 24, 2018, at 2:29 PM, Carlos García <carloscg@gmail.com> wrote:
> >
> > Hi List,
> >
> > The functionality of replacing blocks using ":wrap" seems to be broken.
> > In this email [1] from 2014, a user reported that this was working:
> >
> > ,----
> > | * A
> > |
> > | #+header: :results raw replace :wrap
> > | #+begin_src emacs-lisp
> > |   (+ 2 2)
> > | #+end_src
> > |
> > | #+results:
> > | #+BEGIN_RESULTS
> > | 4
> > | #+END_RESULTS
> > `----
> >
> > i'm running orgmode 9.1.14 and the "BEGIN_RESULTS" blocks are not
> getting overwritten. Can anybody else reproduce this problem?
> >
>
>
> Confirmed.
>
> The issue is that the #+BEGIN/END_results is a `special-block', which is
> not recognized in `org-babel-result-end' as a result type.
>
> I think the fix is to add it.
>
> If the intention is to NOT recognize special-blocks as results, then the
> empty :wrap needs to have some other effect, like enclosing the result in a
> drawer.
>
> HTH,
>
> Chuck
>
>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] src_blocks - :wrap blocks not being overwritten
  2018-10-30 10:35   ` Carlos García
@ 2018-10-30 15:24     ` Berry, Charles
  2018-10-31  9:26       ` Carlos García
  0 siblings, 1 reply; 6+ messages in thread
From: Berry, Charles @ 2018-10-30 15:24 UTC (permalink / raw)
  To: Carlos García; +Cc: Org Mode



> On Oct 30, 2018, at 3:35 AM, Carlos García <carloscg@gmail.com> wrote:
> 
> Hi Chuck,
> 
> Thanks for looking into this. How difficult/desirable would it be to create another block such as "wrap-block" for those blocks created with ":wrap"?

A `special-block' is a syntactic element. A `wrap-block' is not.


> That way, the needed change would be rather elegant:
> 
> :line 2478 of ob-core.el:
> | ;; Possible results types.
> |		     '(drawer example-block export-block fixed-width item
> |			      plain-list src-block table wrap-block)
> 
> What would the repercussions be if `special-block' is added to the list?
> 

Few, I think. But except for those special-blocks that have defined actions they would be ignored upon export.

the `results' special-block would be ignored, IIUC.

I suspect what you want is a `drawer', which encloses results without further consequences that example blocks or export blocks impose.

HTH,

Chuck



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] src_blocks - :wrap blocks not being overwritten
  2018-10-30 15:24     ` Berry, Charles
@ 2018-10-31  9:26       ` Carlos García
  2018-10-31 16:24         ` Berry, Charles
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos García @ 2018-10-31  9:26 UTC (permalink / raw)
  To: ccberry; +Cc: emacs-orgmode

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

Hi Chuck,

The `drawer' option is enough to "wrap" results, but it fails to provide
the customizability that `special-blocks' offer.
For example, `special-blocks' can be iterated with `org-element-map'. From
the point of view of theming, wrapped results use faces, such as
`org-block-begin-line' than can be nicely customized.

The bigger issue is that it "used to work". A few releases ago, wrapped
results could be correctly replaced when using ":results replace". I was
wondering if the change was intentional or a side-effect of something else.

Regards,
Carlos

On Tue, Oct 30, 2018 at 4:24 PM Berry, Charles <ccberry@ucsd.edu> wrote:

>
>
> > On Oct 30, 2018, at 3:35 AM, Carlos García <carloscg@gmail.com> wrote:
> >
> > Hi Chuck,
> >
> > Thanks for looking into this. How difficult/desirable would it be to
> create another block such as "wrap-block" for those blocks created with
> ":wrap"?
>
> A `special-block' is a syntactic element. A `wrap-block' is not.
>
>
> > That way, the needed change would be rather elegant:
> >
> > :line 2478 of ob-core.el:
> > | ;; Possible results types.
> > |                  '(drawer example-block export-block fixed-width item
> > |                           plain-list src-block table wrap-block)
> >
> > What would the repercussions be if `special-block' is added to the list?
> >
>
> Few, I think. But except for those special-blocks that have defined
> actions they would be ignored upon export.
>
> the `results' special-block would be ignored, IIUC.
>
> I suspect what you want is a `drawer', which encloses results without
> further consequences that example blocks or export blocks impose.
>
> HTH,
>
> Chuck
>
>
>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] src_blocks - :wrap blocks not being overwritten
  2018-10-31  9:26       ` Carlos García
@ 2018-10-31 16:24         ` Berry, Charles
  0 siblings, 0 replies; 6+ messages in thread
From: Berry, Charles @ 2018-10-31 16:24 UTC (permalink / raw)
  To: Carlos García; +Cc: emacs-orgmode@gnu.org



> On Oct 31, 2018, at 2:26 AM, Carlos García <carloscg@gmail.com> wrote:
> 
> The bigger issue is that it "used to work". A few releases ago, wrapped results could be correctly replaced when using ":results replace". I was wondering if the change was intentional or a side-effect of something else.
> 

This commit seems to be the one.

| * d7940ae..: Nicolas Goaziou 2017-11-27 ob-core: Fix removal of elements after RESULTS

I am guessing that not including special-blocks was an oversight.

If you prepare a patch, it will likely be applied unless Nicolas sees an issue.

Chuck

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-31 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-24 21:29 [BUG] src_blocks - :wrap blocks not being overwritten Carlos García
2018-10-29 16:00 ` Berry, Charles
2018-10-30 10:35   ` Carlos García
2018-10-30 15:24     ` Berry, Charles
2018-10-31  9:26       ` Carlos García
2018-10-31 16:24         ` Berry, Charles

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).