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