emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: begin_src org :results replace does not work
@ 2017-05-29  1:56 Vikas Rawal
  2017-05-29 17:06 ` Charles C. Berry
  0 siblings, 1 reply; 5+ messages in thread
From: Vikas Rawal @ 2017-05-29  1:56 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

Why does the replace keyword not work? It prepends the results. I have
tried both ":results value replace" and ":results output replace".

I am on org-version 9.0.7

Vikas




#+NAME: one
#+BEGIN_SRC org :results value replace export both
,#+NAME: table-yield
,#+CAPTION: Simple table created using latex tabular environment
,#+attr_latex: :environment tabular :width \textwidth :align lrr
    | State          | Variable one | Varia two |
    |----------------+---------------+----------------|
    | MP             |           672 |          13000 |
    | Har            |           300 |          25000 |
    | Pun            |           260 |          35000 |
#+End_SRC

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

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

* Re: Bug: begin_src org :results replace does not work
  2017-05-29  1:56 Bug: begin_src org :results replace does not work Vikas Rawal
@ 2017-05-29 17:06 ` Charles C. Berry
  2017-05-29 23:24   ` Vikas Rawal
  2017-05-31 14:15   ` Nicolas Goaziou
  0 siblings, 2 replies; 5+ messages in thread
From: Charles C. Berry @ 2017-05-29 17:06 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org

On Mon, 29 May 2017, Vikas Rawal wrote:

> Why does the replace keyword not work? It prepends the results. I have
> tried both ":results value replace" and ":results output replace".
>
> I am on org-version 9.0.7
>
> Vikas
>
>
>
>
> #+NAME: one
> #+BEGIN_SRC org :results value replace export both
> ,#+NAME: table-yield
> ,#+CAPTION: Simple table created using latex tabular environment
> ,#+attr_latex: :environment tabular :width \textwidth :align lrr
>    | State          | Variable one | Varia two |
>    |----------------+---------------+----------------|
>    | MP             |           672 |          13000 |
>    | Har            |           300 |          25000 |
>    | Pun            |           260 |          35000 |
> #+End_SRC
>

The problem is that the results you generate is a table with affiliated 
keywords NAME and CAPTION and ATTR_[backend].

`org-at-table-p' does not recognize that the keywords are followed by a 
table.  Altering this function might be asking for trouble as it is used 
outside babel.

So maybe the cond test should refer to `org-element-context' to better 
sort this out and correctly identify the table end.

Unless/until this happens you can use `:wrap org src'.

HTH,

Chuck

p.s. M-x org-lint RET shows you forgot the `:' before `export'

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

* Re: Bug: begin_src org :results replace does not work
  2017-05-29 17:06 ` Charles C. Berry
@ 2017-05-29 23:24   ` Vikas Rawal
  2017-05-29 23:59     ` Charles C. Berry
  2017-05-31 14:15   ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Vikas Rawal @ 2017-05-29 23:24 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode@gnu.org

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

>
>>
> The problem is that the results you generate is a table with affiliated
> keywords NAME and CAPTION and ATTR_[backend].
>
> `org-at-table-p' does not recognize that the keywords are followed by a
> table.  Altering this function might be asking for trouble as it is used
> outside babel.
>
> So maybe the cond test should refer to `org-element-context' to better
> sort this out and correctly identify the table end.
>
>
Thanks for the explanation.

Since this was meant for use in a tutorial, I wanted #+NAME, etc to be
there.

I will have to use some other work around. :wrap does not work for me, as
it does not remove the , escape characters.

Thanks again,

Vikas

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

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

* Re: Bug: begin_src org :results replace does not work
  2017-05-29 23:24   ` Vikas Rawal
@ 2017-05-29 23:59     ` Charles C. Berry
  0 siblings, 0 replies; 5+ messages in thread
From: Charles C. Berry @ 2017-05-29 23:59 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: emacs-orgmode@gnu.org

On Mon, 29 May 2017, Vikas Rawal wrote:

>>
>>>
>> The problem is that the results you generate is a table with affiliated
>> keywords NAME and CAPTION and ATTR_[backend].
>>
>> `org-at-table-p' does not recognize that the keywords are followed by a
>> table.  Altering this function might be asking for trouble as it is used
>> outside babel.
>>
>> So maybe the cond test should refer to `org-element-context' to better
>> sort this out and correctly identify the table end.
>>
>>
> Thanks for the explanation.
>
> Since this was meant for use in a tutorial, I wanted #+NAME, etc to be
> there.
>
> I will have to use some other work around. :wrap does not work for me, as
> it does not remove the , escape characters.
>

Right. But that should export properly. If you just want to show what the 
src block yields on execution, perhaps:

#+NAME: one
#+BEGIN_SRC org  :results replace drawer
,#+NAME: table-yield
,#+CAPTION: Simple table created using latex tabular environment
,#+attr_latex: :environment tabular :width \textwidth :align lrr
| State | Variable one | Varia two |
|----------------+---------------+----------------|
| MP | 672 | 13000 |
| Har | 300 | 25000 |
| Pun | 260 | 35000 |
#+End_SRC


Chuck

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

* Re: Bug: begin_src org :results replace does not work
  2017-05-29 17:06 ` Charles C. Berry
  2017-05-29 23:24   ` Vikas Rawal
@ 2017-05-31 14:15   ` Nicolas Goaziou
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-05-31 14:15 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode@gnu.org, Vikas Rawal

Hello,

"Charles C. Berry" <ccberry@ucsd.edu> writes:

> On Mon, 29 May 2017, Vikas Rawal wrote:
>
>> Why does the replace keyword not work? It prepends the results. I have
>> tried both ":results value replace" and ":results output replace".
>>
>> I am on org-version 9.0.7
>>
>> Vikas
>>
>>
>>
>>
>> #+NAME: one
>> #+BEGIN_SRC org :results value replace export both
>> ,#+NAME: table-yield
>> ,#+CAPTION: Simple table created using latex tabular environment
>> ,#+attr_latex: :environment tabular :width \textwidth :align lrr
>>    | State          | Variable one | Varia two |
>>    |----------------+---------------+----------------|
>>    | MP             |           672 |          13000 |
>>    | Har            |           300 |          25000 |
>>    | Pun            |           260 |          35000 |
>> #+End_SRC
>>
>
> The problem is that the results you generate is a table with
> affiliated keywords NAME and CAPTION and ATTR_[backend].
>
> `org-at-table-p' does not recognize that the keywords are followed by
> a table.  Altering this function might be asking for trouble as it is
> used outside babel.
>
> So maybe the cond test should refer to `org-element-context' to better
> sort this out and correctly identify the table end.

Even though that change may be interesting on its own, it isn't a proper
solution here. 

Raw values cannot be replaced. The only possible handling is "prepend"
since Org cannot possibly know what the results are. For example, with
the following src block

  #+begin_src org
  Pargraph 1

  Paragaph 2
  #+end_src

Org cannot know if a raw "Parapraph 2" belongs the the results or is
a paragraph following them.

Since "raw" format is special, the most surprising thing here is that
Org src blocks use it as a default.

Anyway, I don't think there is anything to fix (except maybe the
documentation). The OP is requesting an impossible combination of
parameters.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-05-31 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-29  1:56 Bug: begin_src org :results replace does not work Vikas Rawal
2017-05-29 17:06 ` Charles C. Berry
2017-05-29 23:24   ` Vikas Rawal
2017-05-29 23:59     ` Charles C. Berry
2017-05-31 14:15   ` Nicolas Goaziou

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