emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Commas in org source blocks
@ 2011-01-25 18:52 Jeff Horn
  2011-01-25 19:36 ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Horn @ 2011-01-25 18:52 UTC (permalink / raw)
  To: Org-mode ml

The manual doesn't make explicit mention of org as a Babel source
language. Well, it isn't listed in the supported languages, and an
"org mode org source block" site search via Google didn't turn up the
info I'm looking for.

Basically, I tried using example blocks for a table I wrote, but noted
that the key commands for org tables didn't work in the indirect
buffer. Of course, I switched the example block to a source block, and
specified "org" as the language.

After editing in the indirect buffer, there are commas prepended to
each line in the orignal buffer. These are not in the indirect buffer.
Is this the intended behavior? See screenshot for reference.

    http://cl.ly/4C7P

TIA

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

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

* Re: Commas in org source blocks
  2011-01-25 18:52 Commas in org source blocks Jeff Horn
@ 2011-01-25 19:36 ` Eric Schulte
  2011-01-25 20:39   ` Jeff Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2011-01-25 19:36 UTC (permalink / raw)
  To: Jeff Horn; +Cc: Org-mode ml

Jeff Horn <jrhorn424@gmail.com> writes:

> The manual doesn't make explicit mention of org as a Babel source
> language. Well, it isn't listed in the supported languages, and an
> "org mode org source block" site search via Google didn't turn up the
> info I'm looking for.
>

There is support for Org code blocks, evaluation will generally result
in returning a modified (possibly exported) version of the code block
body.

>
> Basically, I tried using example blocks for a table I wrote, but noted
> that the key commands for org tables didn't work in the indirect
> buffer. Of course, I switched the example block to a source block, and
> specified "org" as the language.
>
> After editing in the indirect buffer, there are commas prepended to
> each line in the orignal buffer. These are not in the indirect buffer.
> Is this the intended behavior? See screenshot for reference.
>
>     http://cl.ly/4C7P
>

Yes, this is the intended behavior.  The commas protect your enclosing
source file from markup embedded in the org code block, otherwise a
top-level headline in the body of a code block could break outline
folding for the containing org file.

Best -- Eric

>
> TIA

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

* Re: Commas in org source blocks
  2011-01-25 19:36 ` Eric Schulte
@ 2011-01-25 20:39   ` Jeff Horn
  2011-01-25 21:32     ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Horn @ 2011-01-25 20:39 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org-mode ml

On Tue, Jan 25, 2011 at 2:36 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> There is support for Org code blocks, evaluation will generally result
> in returning a modified (possibly exported) version of the code block
> body.

OK. When I evaluated the block, I got an error about "no function"
being defined for org export. I might need to require babel in my init
file to get it to trigger the autoloads. Could there be another issue?

> Yes, this is the intended behavior.  The commas protect your enclosing
> source file from markup embedded in the org code block, otherwise a
> top-level headline in the body of a code block could break outline
> folding for the containing org file.

Thanks. I haven't used babel much until recently, so thanks for your
patience and helpful response!

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

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

* Re: Commas in org source blocks
  2011-01-25 20:39   ` Jeff Horn
@ 2011-01-25 21:32     ` Eric Schulte
  2011-01-25 22:00       ` Jeff Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2011-01-25 21:32 UTC (permalink / raw)
  To: Jeff Horn; +Cc: Org-mode ml

Jeff Horn <jrhorn424@gmail.com> writes:

> On Tue, Jan 25, 2011 at 2:36 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>> There is support for Org code blocks, evaluation will generally result
>> in returning a modified (possibly exported) version of the code block
>> body.
>
> OK. When I evaluated the block, I got an error about "no function"
> being defined for org export. I might need to require babel in my init
> file to get it to trigger the autoloads. Could there be another issue?
>

yes, you will need to add org-mode to you list of supported languages
along the directions in http://orgmode.org/manual/Languages.html

I'll update the manual to reflect org-mode as a valid language.

>
>> Yes, this is the intended behavior.  The commas protect your enclosing
>> source file from markup embedded in the org code block, otherwise a
>> top-level headline in the body of a code block could break outline
>> folding for the containing org file.
>
> Thanks. I haven't used babel much until recently, so thanks for your
> patience and helpful response!

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

* Re: Commas in org source blocks
  2011-01-25 21:32     ` Eric Schulte
@ 2011-01-25 22:00       ` Jeff Horn
  2011-01-26  1:48         ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Horn @ 2011-01-25 22:00 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org-mode ml

On Tue, Jan 25, 2011 at 4:32 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> yes, you will need to add org-mode to you list of supported languages
> along the directions in http://orgmode.org/manual/Languages.html
>
> I'll update the manual to reflect org-mode as a valid language.

Done, and thanks. One last follow up. I have the following in an org
source block (it is a child of a list item, and I like the indirect
buffer):

#+begin_src org
        ,|            |   | Column Player |     |
        ,|------------+---+---------------+-----|
        ,| /          | < |               | >   |
        ,|            |   | A             | B   |
        ,| Row Player | A | 1,2           | 3,4 |
        ,|            | B | 5,6           | 7,8 |
#+end_src

When I export to HTML or ASCII, the table isn't produced. I was half
expecting an org table (not an HTML table, of course) or at least a
verbatim environment. Adding 'exports: code' didn't change anything.
Any recommendations?

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

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

* Re: Commas in org source blocks
  2011-01-25 22:00       ` Jeff Horn
@ 2011-01-26  1:48         ` Eric Schulte
  2011-01-26  2:21           ` Jeff Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2011-01-26  1:48 UTC (permalink / raw)
  To: Jeff Horn; +Cc: Org-mode ml

Jeff Horn <jrhorn424@gmail.com> writes:

> On Tue, Jan 25, 2011 at 4:32 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>> yes, you will need to add org-mode to you list of supported languages
>> along the directions in http://orgmode.org/manual/Languages.html
>>
>> I'll update the manual to reflect org-mode as a valid language.
>
> Done, and thanks. One last follow up. I have the following in an org
> source block (it is a child of a list item, and I like the indirect
> buffer):
>
> #+begin_src org
>         ,|            |   | Column Player |     |
>         ,|------------+---+---------------+-----|
>         ,| /          | < |               | >   |
>         ,|            |   | A             | B   |
>         ,| Row Player | A | 1,2           | 3,4 |
>         ,|            | B | 5,6           | 7,8 |
> #+end_src
>
> When I export to HTML or ASCII, the table isn't produced. I was half
> expecting an org table (not an HTML table, of course) or at least a
> verbatim environment. Adding 'exports: code' didn't change anything.
> Any recommendations?

Yes, the org-mode language has some weird default header argument which
make its use different from other languages, specifically for every
language but org-mode by default :results has the value of "replace".
Try the following to export org-mode plain or as quoted code.

#+begin_src org :results replace :exports results
        ,|            |   | Column Player |     |
        ,|------------+---+---------------+-----|
        ,| /          | < |               | >   |
        ,|            |   | A             | B   |
        ,| Row Player | A | 1,2           | 3,4 |
        ,|            | B | 5,6           | 7,8 |
#+end_src

#+begin_src org :results replace :exports code
        ,|            |   | Column Player |     |
        ,|------------+---+---------------+-----|
        ,| /          | < |               | >   |
        ,|            |   | A             | B   |
        ,| Row Player | A | 1,2           | 3,4 |
        ,|            | B | 5,6           | 7,8 |
#+end_src

Cheers -- Eric

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

* Re: Commas in org source blocks
  2011-01-26  1:48         ` Eric Schulte
@ 2011-01-26  2:21           ` Jeff Horn
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Horn @ 2011-01-26  2:21 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org-mode ml

On Tue, Jan 25, 2011 at 8:48 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> Jeff Horn <jrhorn424@gmail.com> writes:
>
>> On Tue, Jan 25, 2011 at 4:32 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>> yes, you will need to add org-mode to you list of supported languages
>>> along the directions in http://orgmode.org/manual/Languages.html
>>>
>>> I'll update the manual to reflect org-mode as a valid language.
>>
>> Done, and thanks. One last follow up. I have the following in an org
>> source block (it is a child of a list item, and I like the indirect
>> buffer):
>>
>> #+begin_src org
>>         ,|            |   | Column Player |     |
>>         ,|------------+---+---------------+-----|
>>         ,| /          | < |               | >   |
>>         ,|            |   | A             | B   |
>>         ,| Row Player | A | 1,2           | 3,4 |
>>         ,|            | B | 5,6           | 7,8 |
>> #+end_src
>>
>> When I export to HTML or ASCII, the table isn't produced. I was half
>> expecting an org table (not an HTML table, of course) or at least a
>> verbatim environment. Adding 'exports: code' didn't change anything.
>> Any recommendations?
>
> Yes, the org-mode language has some weird default header argument which
> make its use different from other languages, specifically for every
> language but org-mode by default :results has the value of "replace".
> Try the following to export org-mode plain or as quoted code.
>
> #+begin_src org :results replace :exports results
>        ,|            |   | Column Player |     |
>        ,|------------+---+---------------+-----|
>        ,| /          | < |               | >   |
>        ,|            |   | A             | B   |
>        ,| Row Player | A | 1,2           | 3,4 |
>        ,|            | B | 5,6           | 7,8 |
> #+end_src
>
> #+begin_src org :results replace :exports code
>        ,|            |   | Column Player |     |
>        ,|------------+---+---------------+-----|
>        ,| /          | < |               | >   |
>        ,|            |   | A             | B   |
>        ,| Row Player | A | 1,2           | 3,4 |
>        ,|            | B | 5,6           | 7,8 |
> #+end_src
>
> Cheers -- Eric
>

Many thanks, Eric. That did the trick!

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

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

end of thread, other threads:[~2011-01-26  2:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 18:52 Commas in org source blocks Jeff Horn
2011-01-25 19:36 ` Eric Schulte
2011-01-25 20:39   ` Jeff Horn
2011-01-25 21:32     ` Eric Schulte
2011-01-25 22:00       ` Jeff Horn
2011-01-26  1:48         ` Eric Schulte
2011-01-26  2:21           ` Jeff Horn

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