emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Indentation messed up after example block
@ 2014-07-06 18:03 York Zhao
  2014-07-07 11:23 ` Alexander Baier
  0 siblings, 1 reply; 4+ messages in thread
From: York Zhao @ 2014-07-06 18:03 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi list,

I just noticed a problem that org-mode indentation gets messed up after
"example" block. Here is ECM:

#+STARTUP: indent

* Level one
** Level two
Indentation is right.

#+BEGIN_EXAMPLE
* Example at level one
#+END_EXAMPLE

Indentation is wrong.

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

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

* Re: Indentation messed up after example block
  2014-07-06 18:03 Indentation messed up after example block York Zhao
@ 2014-07-07 11:23 ` Alexander Baier
  2014-07-07 15:19   ` York Zhao
  2014-07-07 16:09   ` Brett Viren
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Baier @ 2014-07-07 11:23 UTC (permalink / raw)
  To: York Zhao; +Cc: emacs-orgmode

On 2014-07-06 20:03 York Zhao wrote:
> Hi list,
>
> I just noticed a problem that org-mode indentation gets messed up after
> "example" block. Here is ECM:
>
> #+STARTUP: indent
>
> * Level one
> ** Level two
> Indentation is right.
>
> #+BEGIN_EXAMPLE
> * Example at level one
> #+END_EXAMPLE
>
> Indentation is wrong.

The asterisk followed by a space followed by text in your example block
is recognized by org as a headline. So org thinks everything under that
headline is the body of the headline.

You can fix this by not letting "* Example at level one" start at the
beginning of the line, but instead indent it by one or more spaces or
prefix it with some other character(s).

HTH,
-- 
Alexander Baier

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

* Re: Indentation messed up after example block
  2014-07-07 11:23 ` Alexander Baier
@ 2014-07-07 15:19   ` York Zhao
  2014-07-07 16:09   ` Brett Viren
  1 sibling, 0 replies; 4+ messages in thread
From: York Zhao @ 2014-07-07 15:19 UTC (permalink / raw)
  To: York Zhao, emacs-orgmode

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

>> Hi list,
>>
>> I just noticed a problem that org-mode indentation gets messed up after
>> "example" block. Here is ECM:
>>
>> #+STARTUP: indent
>>
>> * Level one
>> ** Level two
>> Indentation is right.
>>
>> #+BEGIN_EXAMPLE
>> * Example at level one
>> #+END_EXAMPLE
>>
>> Indentation is wrong.

> The asterisk followed by a space followed by text in your example block
> is recognized by org as a headline. So org thinks everything under that
> headline is the body of the headline.

I knew this is exactly the reason. But the question is shouldn't `org-mode'
ignore headlines in example block. I'm not sure whether this is easy or not
though.

> You can fix this by not letting "* Example at level one" start at the
> beginning of the line, but instead indent it by one or more spaces or
prefix
> it with some other character(s).

Smart workaround. Thanks.

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

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

* Re: Indentation messed up after example block
  2014-07-07 11:23 ` Alexander Baier
  2014-07-07 15:19   ` York Zhao
@ 2014-07-07 16:09   ` Brett Viren
  1 sibling, 0 replies; 4+ messages in thread
From: Brett Viren @ 2014-07-07 16:09 UTC (permalink / raw)
  To: York Zhao; +Cc: emacs-orgmode

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

Hi,

Alexander Baier <alexander.baier@mailbox.org> writes:

> On 2014-07-06 20:03 York Zhao wrote:
...
>> #+BEGIN_EXAMPLE
>> * Example at level one
>> #+END_EXAMPLE
>>
>> Indentation is wrong.
>
> The asterisk followed by a space followed by text in your example block
> is recognized by org as a headline. So org thinks everything under that
> headline is the body of the headline.

I hit this very problem recently and first assumed it must be a bug.
But, since it's documented[1] I guess it's a "feature".  Although one I
don't immediately see a use for.

I hit this when capturing some logging info which happened to have a
line starting with a triple-*.  Trying to manually find such offending
lines in a large EXAMPLE block is too tedious to contemplate.  A better
way, which is implied by that footnote, is to use Org Src buffers when
entering the content of EXAMPLE blocks in the first place.  I do like:

  <e TAB C-c' <PASTE> C-c'

Where <PASTE> is me pasting or typing whatever is the content of the
EXAMPLE block.

This will not only indent the entire block with a couple of spaces but
will "escape" the problematic headline asterisk with the "special
syntax" comma.

-Brett.

[1] http://orgmode.org/manual/Literal-examples.html#fnd-4

[-- Attachment #2: Type: application/pgp-signature, Size: 180 bytes --]

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

end of thread, other threads:[~2014-07-07 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-06 18:03 Indentation messed up after example block York Zhao
2014-07-07 11:23 ` Alexander Baier
2014-07-07 15:19   ` York Zhao
2014-07-07 16:09   ` Brett Viren

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