emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problem with example block and headings
@ 2009-10-12 10:46 Eric S Fraga
  2009-10-12 13:09 ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2009-10-12 10:46 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

This is not a critical problem but I thought I would highlight it.  

If you have an example block which includes lines that look like
org-mode headings, the show/collapse commands get confused.  The two
images attached show the erroneous behaviour for a file with these
contents:

--8<---------------cut here---------------start------------->8---
* example blocks
  The following is an example of the contents of a simple org-mode file:
#+begin_example problem with org interpretation of contents
  This is an example of a simple org-mode file
* The main heading
** A sub-heading
** another sub-heading
   - a list
   - second entry
#+end_example
     That example shows the hierarchical structure and the use of lists.
** Further text here
This is more text that is in a sub-section
--8<---------------cut here---------------end--------------->8---

Although a contrived example, this arose from my use of org-babel-sh
and having output generated that happened to have lines starting with
'* '.  

Note also the indentation of the line immediately after the end of the
example.

thanks,
eric


[-- Attachment #2: expanded.jpg --]
[-- Type: image/jpeg, Size: 32917 bytes --]

[-- Attachment #3: collapsed.jpg --]
[-- Type: image/jpeg, Size: 6275 bytes --]

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: problem with example block and headings
  2009-10-12 10:46 problem with example block and headings Eric S Fraga
@ 2009-10-12 13:09 ` Carsten Dominik
  2009-10-12 15:24   ` Eric S Fraga
  2009-10-12 16:20   ` [patch] Re: problem with example block and headings Dan Davison
  0 siblings, 2 replies; 7+ messages in thread
From: Carsten Dominik @ 2009-10-12 13:09 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hi Eric,

please move the cursor into the example block and press "C-c '" (that  
is C-c followed by the single quote.  This will get you into a special  
editing buffer for this snippet.  When you exit by pressing the same  
keys again, you will see what Org does to quote such headlines.

Also, you might enjoy your example even better if you use

   #+begin_src org

instead of

   #+begin_example

HTH

- Carsten

On Oct 12, 2009, at 12:46 PM, Eric S Fraga wrote:

> Hello,
>
> This is not a critical problem but I thought I would highlight it.
>
> If you have an example block which includes lines that look like
> org-mode headings, the show/collapse commands get confused.  The two
> images attached show the erroneous behaviour for a file with these
> contents:
>
> --8<---------------cut here---------------start------------->8---
> * example blocks
>  The following is an example of the contents of a simple org-mode  
> file:
> #+begin_example problem with org interpretation of contents
>  This is an example of a simple org-mode file
> * The main heading
> ** A sub-heading
> ** another sub-heading
>   - a list
>   - second entry
> #+end_example
>     That example shows the hierarchical structure and the use of  
> lists.
> ** Further text here
> This is more text that is in a sub-section
> --8<---------------cut here---------------end--------------->8---
>
> Although a contrived example, this arose from my use of org-babel-sh
> and having output generated that happened to have lines starting with
> '* '.
>
> Note also the indentation of the line immediately after the end of the
> example.
>
> thanks,
> eric
>
> < 
> expanded 
> .jpg><collapsed.jpg>_______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: problem with example block and headings
  2009-10-12 13:09 ` Carsten Dominik
@ 2009-10-12 15:24   ` Eric S Fraga
  2009-10-12 15:40     ` Giovanni Ridolfi
  2009-10-12 16:20   ` [patch] Re: problem with example block and headings Dan Davison
  1 sibling, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2009-10-12 15:24 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

At Mon, 12 Oct 2009 15:09:31 +0200,
Carsten Dominik wrote:
> 
> Hi Eric,
> 
> please move the cursor into the example block and press "C-c '" (that
> is C-c followed by the single quote.  This will get you into a special
> editing buffer for this snippet.  When you exit by pressing the same
> keys again, you will see what Org does to quote such headlines.
> 
> Also, you might enjoy your example even better if you use
> 
>   #+begin_src org
> 
> instead of
> 
>   #+begin_example
> 
> HTH
> 
> - Carsten

Carsten,

What you suggest is perfectly reasonable in normal circumstances.  My
situation is that I ran into this problem when using org-babel [1],
specifically the sh module.  It generates an example block with the
output verbatim.

I guess the solution is to somehow get the shell command output
converted to not cause the problems...  I'll investigate.  As I said
in my original message, it's not a critical issue!

Thanks,
eric

Footnotes: 
[1]  I wonder whether there should be a separate orb-babel mailing
     list to avoid too much noise in the org-mode list?

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

* Re: problem with example block and headings
  2009-10-12 15:24   ` Eric S Fraga
@ 2009-10-12 15:40     ` Giovanni Ridolfi
  2009-10-12 17:01       ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Giovanni Ridolfi @ 2009-10-12 15:40 UTC (permalink / raw)
  To: Carsten Dominik, Eric S Fraga; +Cc: emacs-orgmode

--- Lun 12/10/09, Eric S Fraga <ucecesf@ucl.ac.uk> ha scritto:
> Footnotes: 
> [1]  I wonder whether there should be a separate
> orb-babel mailing list to avoid too much noise 
> in the org-mode list?

what about a tag in the subject line such as:

Subject: [babel] problem with example block and headings

cheers,
 
Giovanni




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

* [patch] Re: problem with example block and headings
  2009-10-12 13:09 ` Carsten Dominik
  2009-10-12 15:24   ` Eric S Fraga
@ 2009-10-12 16:20   ` Dan Davison
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Davison @ 2009-10-12 16:20 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Eric,
>
> please move the cursor into the example block and press "C-c '" (that
> is C-c followed by the single quote.  This will get you into a special
> editing buffer for this snippet.  When you exit by pressing the same
> keys again, you will see what Org does to quote such headlines.

Hmm, and you also see that point jumps around by one character.

Carsten, please consider merging branch ded-org-src at

git://repo.or.cz/org-mode/babel.git

Dan

--8<---------------cut here---------------start------------->8---
commit 23b4026937572339a453922bb79a05d1e82597e7
Author: Dan Davison <davison@stats.ox.ac.uk>
Date:   Mon Oct 12 12:13:08 2009 -0400

    org-src-mode: maintain relative location of point when lines are protected

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 796e914..03e5b45 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -229,6 +229,7 @@ the edited version."
        (when org-mode-p
          (goto-char (point-min))
          (while (re-search-forward "^," nil t)
+           (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent)))
            (replace-match "")))
        (org-goto-line (1+ (- line begline)))
        (org-move-to-column
@@ -463,7 +464,7 @@ the language, a switch telling if the content should be in a single line."
         (total-nindent (+ (or org-edit-src-block-indentation 0)
                           org-edit-src-content-indentation))
         (preserve-indentation org-src-preserve-indentation)
-        code line col indent)
+        (delta 0) code line col indent)
     (untabify (point-min) (point-max))
     (save-excursion
       (goto-char (point-min))
@@ -490,6 +491,7 @@ the language, a switch telling if the content should be in a single line."
       (goto-char (point-min))
       (while (re-search-forward
              (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t)
+       (if (eq (org-current-line) line) (setq delta (1+ delta)))
        (replace-match ",\\1")))
     (when (org-bound-and-true-p org-edit-src-picture)
       (setq preserve-indentation nil)
@@ -514,7 +516,7 @@ the language, a switch telling if the content should be in a single line."
     (goto-char beg)
     (if single (just-one-space))
     (org-goto-line (1- (+ (org-current-line) line)))
-    (org-move-to-column (if preserve-indentation col (+ col total-nindent)))
+    (org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))
     (move-marker beg nil)
     (move-marker end nil)))
--8<---------------cut here---------------end--------------->8---



>
> Also, you might enjoy your example even better if you use
>
>   #+begin_src org
>
> instead of
>
>   #+begin_example
>
> HTH
>
> - Carsten
>
> On Oct 12, 2009, at 12:46 PM, Eric S Fraga wrote:
>
>> Hello,
>>
>> This is not a critical problem but I thought I would highlight it.
>>
>> If you have an example block which includes lines that look like
>> org-mode headings, the show/collapse commands get confused.  The two
>> images attached show the erroneous behaviour for a file with these
>> contents:
>>
>> --8<---------------cut here---------------start------------->8---
>> * example blocks
>>  The following is an example of the contents of a simple org-mode
>> file:
>> #+begin_example problem with org interpretation of contents
>>  This is an example of a simple org-mode file
>> * The main heading
>> ** A sub-heading
>> ** another sub-heading
>>   - a list
>>   - second entry
>> #+end_example
>>     That example shows the hierarchical structure and the use of
>> lists.
>> ** Further text here
>> This is more text that is in a sub-section
>> --8<---------------cut here---------------end--------------->8---
>>
>> Although a contrived example, this arose from my use of org-babel-sh
>> and having output generated that happened to have lines starting with
>> '* '.
>>
>> Note also the indentation of the line immediately after the end of the
>> example.
>>
>> thanks,
>> eric
>>
>> <
>> expanded
>> .jpg><collapsed.jpg>_______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: problem with example block and headings
  2009-10-12 15:40     ` Giovanni Ridolfi
@ 2009-10-12 17:01       ` Eric Schulte
  2009-10-13  7:57         ` New guidelines for posting about org-babel (was problem with example block and headings) Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2009-10-12 17:01 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode, Carsten Dominik

Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:

> --- Lun 12/10/09, Eric S Fraga <ucecesf@ucl.ac.uk> ha scritto:
>> Footnotes: 
>> [1]  I wonder whether there should be a separate
>> orb-babel mailing list to avoid too much noise 
>> in the org-mode list?
>
> what about a tag in the subject line such as:
>
> Subject: [babel] problem with example block and headings
>

I second Giovanni's suggestion.

The Org-mode mailing list is such a nice community I would hate for the
Org-babel discussions to leave it, at least until Carsten kicks us
out :). -- Eric

>
> cheers,
>  
> Giovanni
>
>
>       
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* New guidelines for posting about org-babel (was problem with example block and headings)
  2009-10-12 17:01       ` Eric Schulte
@ 2009-10-13  7:57         ` Carsten Dominik
  0 siblings, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2009-10-13  7:57 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


On Oct 12, 2009, at 7:01 PM, Eric Schulte wrote:

> Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> writes:
>
>> --- Lun 12/10/09, Eric S Fraga <ucecesf@ucl.ac.uk> ha scritto:
>>> Footnotes:
>>> [1]  I wonder whether there should be a separate
>>> orb-babel mailing list to avoid too much noise
>>> in the org-mode list?
>>
>> what about a tag in the subject line such as:
>>
>> Subject: [babel] problem with example block and headings
>>
>
> I second Giovanni's suggestion.

So lets make this a rule.

Can I please ask people discussing features of org-babel on this
mailing list to mark their posts with [babel] in the headline?
This will allow those who are not interested in this part of the
discussion to filter against such messages, or to automatically
sort them into a separate folder.

Thanks!

- Carsten

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

end of thread, other threads:[~2009-10-13 18:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12 10:46 problem with example block and headings Eric S Fraga
2009-10-12 13:09 ` Carsten Dominik
2009-10-12 15:24   ` Eric S Fraga
2009-10-12 15:40     ` Giovanni Ridolfi
2009-10-12 17:01       ` Eric Schulte
2009-10-13  7:57         ` New guidelines for posting about org-babel (was problem with example block and headings) Carsten Dominik
2009-10-12 16:20   ` [patch] Re: problem with example block and headings Dan Davison

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