emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] Asterisks in source and example blocks interpreted as headings
@ 2011-08-16 18:27 Jason Dunsmore
  2011-08-16 19:51 ` Bastien
  2011-08-17 11:05 ` Daniel Bausch
  0 siblings, 2 replies; 9+ messages in thread
From: Jason Dunsmore @ 2011-08-16 18:27 UTC (permalink / raw)
  To: Org-mode mailing list

Hello,

I noticed that lines with leading asterisks inside of source and example
blocks are interpreted as headings:

--8<---------------cut here---------------start------------->8---
* Heading 1

#+begin_example
foo
* bar
blah
#+end_example

* Heading 2
--8<---------------cut here---------------end--------------->8---

If you put the point on "Heading 1" and hit TAB, you'll see the
following:

--8<---------------cut here---------------start------------->8---
* Heading 1...
* bar
blah
#+end_example

* Heading 2
--8<---------------cut here---------------end--------------->8---

I'm using GNU Emacs 23.2.1 and Org-mode version 7.7
(release_7.7.97.g9d5c5)

Regards,
Jason

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-16 18:27 [bug] Asterisks in source and example blocks interpreted as headings Jason Dunsmore
@ 2011-08-16 19:51 ` Bastien
  2011-08-16 20:22   ` Jason Dunsmore
  2011-08-17 11:05 ` Daniel Bausch
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2011-08-16 19:51 UTC (permalink / raw)
  To: Jason Dunsmore; +Cc: Org-mode mailing list

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

Hi Jason,

Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:

> I noticed that lines with leading asterisks inside of source and example
> blocks are interpreted as headings:

The attached patch should fix this -- please confirm.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Fix-bug-about-headlines-in-blocks.patch --]
[-- Type: text/x-patch, Size: 1895 bytes --]

From 4ff6f7a78c07654e70ac8473c911b873340f0b67 Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Tue, 16 Aug 2011 21:51:02 +0200
Subject: [PATCH] org.el: Fix bug about headlines in blocks.

* org.el (org-cycle): Use `org-at-heading-p'.
(org-heading-forbidden-blocks): Variable alias to
`org-list-forbidden-blocks'.
(org-on-heading-p, org-at-heading-p): only perform the check
when we are in allowed blocks, otherwise just return nil.

Thanks to Jason Dunsmor for pointing at this.
---
 lisp/org.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2c38b33..2eabcb8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5994,8 +5994,7 @@ in special contexts.
 
        ;; At an item/headline: delegate to `org-cycle-internal-local'.
        ((and (or (and org-cycle-include-plain-lists (org-at-item-p))
-		 (save-excursion (beginning-of-line 1)
-				 (looking-at org-outline-regexp)))
+		 (org-at-heading-p))
 	     (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
 	(org-cycle-internal-local))
 
@@ -20067,10 +20066,17 @@ This version does not only check the character property, but also
     (end-of-line)
     (null (re-search-backward org-outline-regexp-bol nil t))))
 
+(defvaralias 'org-heading-forbidden-blocks 'org-list-forbidden-blocks
+  "List of blocks where a heading should not be treated as such.
+See `org-list-forbidden-blocks'.")
+
 (defun org-on-heading-p (&optional ignored)
-  (outline-on-heading-p t))
+  (unless (org-in-block-p org-heading-forbidden-blocks)
+    (outline-on-heading-p t)))
+
 (defun org-at-heading-p (&optional ignored)
-  (outline-on-heading-p t))
+  (unless (org-in-block-p org-heading-forbidden-blocks)
+    (outline-on-heading-p t)))
 
 (defun org-point-at-end-of-empty-headline ()
   "If point is at the end of an empty headline, return t, else nil.
-- 
1.7.5.2


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-16 19:51 ` Bastien
@ 2011-08-16 20:22   ` Jason Dunsmore
  2011-08-25 13:27     ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Dunsmore @ 2011-08-16 20:22 UTC (permalink / raw)
  To: Bastien; +Cc: Org-mode mailing list

Bastien <bzg@altern.org> writes:

> Hi Jason,
>
> Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:
>
>> I noticed that lines with leading asterisks inside of source and example
>> blocks are interpreted as headings:
>
> The attached patch should fix this -- please confirm.

Hm, I'm still seeing the same issue with both source and example blocks.

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-16 18:27 [bug] Asterisks in source and example blocks interpreted as headings Jason Dunsmore
  2011-08-16 19:51 ` Bastien
@ 2011-08-17 11:05 ` Daniel Bausch
  2011-08-19 12:19   ` Eric Schulte
  1 sibling, 1 reply; 9+ messages in thread
From: Daniel Bausch @ 2011-08-17 11:05 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

AFAIK that is exactly the case, for which the "," rule is for.
Just put a "," in front of the offending line and everything will be fine.
On export the "," is removed.

best regards,
Daniel

Am Dienstag 16 August 2011, 20:27:01 schrieb Jason Dunsmore:
> Hello,
> 
> I noticed that lines with leading asterisks inside of source and example
> blocks are interpreted as headings:
> 
> --8<---------------cut here---------------start------------->8---
> * Heading 1
> 
> #+begin_example
> foo
> * bar
> blah
> #+end_example
> 
> * Heading 2
> --8<---------------cut here---------------end--------------->8---
> 
> If you put the point on "Heading 1" and hit TAB, you'll see the
> following:
> 
> --8<---------------cut here---------------start------------->8---
> * Heading 1...
> * bar
> blah
> #+end_example
> 
> * Heading 2
> --8<---------------cut here---------------end--------------->8---
> 
> I'm using GNU Emacs 23.2.1 and Org-mode version 7.7
> (release_7.7.97.g9d5c5)
> 
> Regards,
> Jason

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-17 11:05 ` Daniel Bausch
@ 2011-08-19 12:19   ` Eric Schulte
  2011-08-19 19:53     ` Sebastien Vauban
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Schulte @ 2011-08-19 12:19 UTC (permalink / raw)
  To: Daniel Bausch; +Cc: emacs-orgmode

Using org-edit-special bound to C-c ' to edit the contents of source or
example blocks will inserted the leading ","s automatically when they
are required.

Best -- Eric

Daniel Bausch <DanielBausch@gmx.de> writes:

> Hi,
>
> AFAIK that is exactly the case, for which the "," rule is for.
> Just put a "," in front of the offending line and everything will be fine.
> On export the "," is removed.
>
> best regards,
> Daniel
>
> Am Dienstag 16 August 2011, 20:27:01 schrieb Jason Dunsmore:
>> Hello,
>> 
>> I noticed that lines with leading asterisks inside of source and example
>> blocks are interpreted as headings:
>> 
>> --8<---------------cut here---------------start------------->8---
>> * Heading 1
>> 
>> #+begin_example
>> foo
>> * bar
>> blah
>> #+end_example
>> 
>> * Heading 2
>> --8<---------------cut here---------------end--------------->8---
>> 
>> If you put the point on "Heading 1" and hit TAB, you'll see the
>> following:
>> 
>> --8<---------------cut here---------------start------------->8---
>> * Heading 1...
>> * bar
>> blah
>> #+end_example
>> 
>> * Heading 2
>> --8<---------------cut here---------------end--------------->8---
>> 
>> I'm using GNU Emacs 23.2.1 and Org-mode version 7.7
>> (release_7.7.97.g9d5c5)
>> 
>> Regards,
>> Jason
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-19 12:19   ` Eric Schulte
@ 2011-08-19 19:53     ` Sebastien Vauban
  0 siblings, 0 replies; 9+ messages in thread
From: Sebastien Vauban @ 2011-08-19 19:53 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi,

Eric Schulte wrote:
> Daniel Bausch <DanielBausch-Mmb7MZpHnFY@public.gmane.org> writes:
>> AFAIK that is exactly the case, for which the "," rule is for.
>> Just put a "," in front of the offending line and everything will be fine.
>> On export the "," is removed.
>
> Using org-edit-special bound to C-c ' to edit the contents of source or
> example blocks will inserted the leading ","s automatically when they
> are required.

Or TAB'ing inside the code block in the source Org buffer.

Best regards,
  Seb

PS- I (almost) never use the indirect buffer anymore, thanks to native
    highlighting.

-- 
Sebastien Vauban

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-16 20:22   ` Jason Dunsmore
@ 2011-08-25 13:27     ` Bastien
  2011-08-25 13:31       ` Carsten Dominik
  2011-08-31 19:52       ` Jason Dunsmore
  0 siblings, 2 replies; 9+ messages in thread
From: Bastien @ 2011-08-25 13:27 UTC (permalink / raw)
  To: Jason Dunsmore; +Cc: Org-mode mailing list

Hi Jason,

Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:

> Bastien <bzg@altern.org> writes:
>
>> Hi Jason,
>>
>> Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:
>>
>>> I noticed that lines with leading asterisks inside of source and example
>>> blocks are interpreted as headings:
>>
>> The attached patch should fix this -- please confirm.
>
> Hm, I'm still seeing the same issue with both source and example
> blocks.

Yes -- my patch only took care of not allowing *manually* folding
headlines in selected environments.  But those headlines were still
folded when finding an org file with "#+STARTUP: fold" in it.

In the meantime, is it okay for you to TAB and have the commas
automatically added, as Sébastien suggested?

-- 
 Bastien

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-25 13:27     ` Bastien
@ 2011-08-25 13:31       ` Carsten Dominik
  2011-08-31 19:52       ` Jason Dunsmore
  1 sibling, 0 replies; 9+ messages in thread
From: Carsten Dominik @ 2011-08-25 13:31 UTC (permalink / raw)
  To: Bastien; +Cc: Jason Dunsmore, Org-mode mailing list


On Aug 25, 2011, at 3:27 PM, Bastien wrote:

> Hi Jason,
> 
> Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:
> 
>> Bastien <bzg@altern.org> writes:
>> 
>>> Hi Jason,
>>> 
>>> Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:
>>> 
>>>> I noticed that lines with leading asterisks inside of source and example
>>>> blocks are interpreted as headings:
>>> 
>>> The attached patch should fix this -- please confirm.
>> 
>> Hm, I'm still seeing the same issue with both source and example
>> blocks.
> 
> Yes -- my patch only took care of not allowing *manually* folding
> headlines in selected environments.  But those headlines were still
> folded when finding an org file with "#+STARTUP: fold" in it.
> 
> In the meantime, is it okay for you to TAB and have the commas
> automatically added, as Sébastien suggested?


This requires

(setq org-src-tab-acts-natively t)

- Caraten


> 
> -- 
> Bastien
> 

- Carsten

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

* Re: [bug] Asterisks in source and example blocks interpreted as headings
  2011-08-25 13:27     ` Bastien
  2011-08-25 13:31       ` Carsten Dominik
@ 2011-08-31 19:52       ` Jason Dunsmore
  1 sibling, 0 replies; 9+ messages in thread
From: Jason Dunsmore @ 2011-08-31 19:52 UTC (permalink / raw)
  To: Bastien; +Cc: Org-mode mailing list

Bastien <bzg@altern.org> writes:

> Hi Jason,
>
> Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:
>
>> Bastien <bzg@altern.org> writes:
>>
>>> Hi Jason,
>>>
>>> Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:
>>>
>>>> I noticed that lines with leading asterisks inside of source and example
>>>> blocks are interpreted as headings:
>>>
>>> The attached patch should fix this -- please confirm.
>>
>> Hm, I'm still seeing the same issue with both source and example
>> blocks.
>
> Yes -- my patch only took care of not allowing *manually* folding
> headlines in selected environments.  But those headlines were still
> folded when finding an org file with "#+STARTUP: fold" in it.
>
> In the meantime, is it okay for you to TAB and have the commas
> automatically added, as Sébastien suggested?

Sure, that works.  I've turned on `org-src-tab-acts-natively' as Carsten
suggested.  I also re-enabled `org-edit-src-content-indentation', which
was previously set to 0.

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

end of thread, other threads:[~2011-08-31 19:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-16 18:27 [bug] Asterisks in source and example blocks interpreted as headings Jason Dunsmore
2011-08-16 19:51 ` Bastien
2011-08-16 20:22   ` Jason Dunsmore
2011-08-25 13:27     ` Bastien
2011-08-25 13:31       ` Carsten Dominik
2011-08-31 19:52       ` Jason Dunsmore
2011-08-17 11:05 ` Daniel Bausch
2011-08-19 12:19   ` Eric Schulte
2011-08-19 19:53     ` Sebastien Vauban

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