emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* M-RET inside the first second-level heading of the first first-level heading
@ 2013-04-25 20:39 Jisang Yoo
  2013-04-25 21:51 ` John Hendy
  2013-04-26  6:54 ` Bastien
  0 siblings, 2 replies; 9+ messages in thread
From: Jisang Yoo @ 2013-04-25 20:39 UTC (permalink / raw)
  To: emacs-orgmode

short description:

When I try to create a new heading using M-RET, it works as expected except 
one case: inside the first second-level heading of the first first-level 
heading. This bug affects the latest ELPA version of org, but not the latest 
bundled-with-Emacs version

long description:

Org version 8.0.1-6-ge6776c-elpaplus
GNU Emacs 24.3.1

Create an org buffer with the following contents

* crunchy
** bacon
* soft
** tofu
* warm
** milk

1. Place cursor at the end of bacon and press M-RET and org creates a first-
level heading, when it should have created a second level heading as it does 
at the end of tofu or milk.

2. Place cursor at the beginning of "** bacon" and press M-RET and org creates 
a first-level heading.

The odd behavior disappears after I add an empty line before the first 
heading.

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-04-25 20:39 M-RET inside the first second-level heading of the first first-level heading Jisang Yoo
@ 2013-04-25 21:51 ` John Hendy
  2013-04-26  6:54 ` Bastien
  1 sibling, 0 replies; 9+ messages in thread
From: John Hendy @ 2013-04-25 21:51 UTC (permalink / raw)
  To: Jisang Yoo; +Cc: emacs-orgmode

On Thu, Apr 25, 2013 at 3:39 PM, Jisang Yoo <jisang.yoo.ac+org@gmail.com> wrote:
> short description:
>
> When I try to create a new heading using M-RET, it works as expected except
> one case: inside the first second-level heading of the first first-level
> heading. This bug affects the latest ELPA version of org, but not the latest
> bundled-with-Emacs version
>
> long description:
>
> Org version 8.0.1-6-ge6776c-elpaplus
> GNU Emacs 24.3.1
>
> Create an org buffer with the following contents
>
> * crunchy
> ** bacon
> * soft
> ** tofu
> * warm
> ** milk
>
> 1. Place cursor at the end of bacon and press M-RET and org creates a first-
> level heading, when it should have created a second level heading as it does
> at the end of tofu or milk.
>
> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
> a first-level heading.

I can replicate on Org-mode version 8.0.1 (release_8.0.1-40-g38051c).

>
> The odd behavior disappears after I add an empty line before the first
> heading.

I can also replicate this. Also odd is that if I put text under the
first headline, it doesn't seem to matter what spacing is before/after
it; ** bacon<cursor> and M-RET will create a first level headline.

* crunchy

Test of some stuff.

** bacon

I can delete the empty space between "Test of some stuff." and the
first headline, or add more spaces, add more spaces between ** bacon
and * soft, and I always get a first level headline with M-RET after
** bacon. Same with C-RET.


John

>
>

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-04-25 20:39 M-RET inside the first second-level heading of the first first-level heading Jisang Yoo
  2013-04-25 21:51 ` John Hendy
@ 2013-04-26  6:54 ` Bastien
  2013-05-02 18:51   ` John Hendy
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2013-04-26  6:54 UTC (permalink / raw)
  To: Jisang Yoo; +Cc: emacs-orgmode

Hi Jisang,

Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:

> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates 
> a first-level heading.

This should now be fixed.  Thanks for reporting this,

-- 
 Bastien

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-04-26  6:54 ` Bastien
@ 2013-05-02 18:51   ` John Hendy
  2013-05-02 18:52     ` John Hendy
  2013-05-07  9:54     ` Bastien
  0 siblings, 2 replies; 9+ messages in thread
From: John Hendy @ 2013-05-02 18:51 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Jisang Yoo

On Fri, Apr 26, 2013 at 1:54 AM, Bastien <bzg@gnu.org> wrote:
> Hi Jisang,
>
> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>
>> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
>> a first-level heading.
>
> This should now be fixed.  Thanks for reporting this,

There were some same/similar/related issues as well, and I'm still not
getting perfect results.

Using a minimal config (below), if I create this in a new file

* test
** test1
** test2

and then fold on * test, I get this:

* test...2

Also, after navigating to the end of * test...2 (with it folded) and
issuing M-RET, I get a new second level heading after ** test2. I
would have expected a new first level headline since I did M-RET on a
first level headline. Or is that the default behavior?

If so, I guess my only concern is the folding of the end of a headline
if there's no hard return after it into the ellipsis of it's parent.


Thanks!
John

>
> --
>  Bastien
>

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-05-02 18:51   ` John Hendy
@ 2013-05-02 18:52     ` John Hendy
  2013-05-07  9:54     ` Bastien
  1 sibling, 0 replies; 9+ messages in thread
From: John Hendy @ 2013-05-02 18:52 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Jisang Yoo

On Thu, May 2, 2013 at 1:51 PM, John Hendy <jw.hendy@gmail.com> wrote:
> On Fri, Apr 26, 2013 at 1:54 AM, Bastien <bzg@gnu.org> wrote:
>> Hi Jisang,
>>
>> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>>
>>> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
>>> a first-level heading.
>>
>> This should now be fixed.  Thanks for reporting this,
>
> There were some same/similar/related issues as well, and I'm still not
> getting perfect results.
>
> Using a minimal config (below), if I create this in a new file

Sorry... config used with emacs -Q is this:

;; set load paths
;; set load dirs and global config options
(add-to-list 'load-path "~/.elisp/org.git/lisp/")
(add-to-list 'load-path "~/.elisp/org.git/contrib/lisp")

[deleted]

John

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-05-02 18:51   ` John Hendy
  2013-05-02 18:52     ` John Hendy
@ 2013-05-07  9:54     ` Bastien
  2013-05-07 21:34       ` John Hendy
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2013-05-07  9:54 UTC (permalink / raw)
  To: John Hendy; +Cc: Jisang Yoo, emacs-orgmode

Hi John,

John Hendy <jw.hendy@gmail.com> writes:

> On Fri, Apr 26, 2013 at 1:54 AM, Bastien <bzg@gnu.org> wrote:
>> Hi Jisang,
>>
>> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>>
>>> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
>>> a first-level heading.
>>
>> This should now be fixed.  Thanks for reporting this,
>
> There were some same/similar/related issues as well, and I'm still not
> getting perfect results.
>
> Using a minimal config (below), if I create this in a new file
>
> * test
> ** test1
> ** test2
>
> and then fold on * test, I get this:
>
> * test...2

I do have (setq require-final-newline t) in my config, which prevents
this.  What happens is this: if you don't have the config above, the
folding will get wrong and display the "2" from the end of the buffer.

> Also, after navigating to the end of * test...2 (with it folded) and
> issuing M-RET, I get a new second level heading after ** test2. I
> would have expected a new first level headline since I did M-RET on a
> first level headline. Or is that the default behavior?

If you are before the "..." ellipsis, you are on a first level
headline and M-RET will insert a first level headline.  Otherwise you
are on a second level headline ("test2") and it will insert a second
level headline.

> If so, I guess my only concern is the folding of the end of a headline
> if there's no hard return after it into the ellipsis of it's parent.

Yes.  Maybe M-RET could/should handle this corner-case but since
`org-insert-heading' is deserving a full rewrite, I'm not going to
try to handle this corner-case myself... let's just keep it in mind 
when doing the rewrite.  Thanks for spotting it,

-- 
 Bastien

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-05-07  9:54     ` Bastien
@ 2013-05-07 21:34       ` John Hendy
  2013-05-10  6:49         ` Carsten Dominik
  0 siblings, 1 reply; 9+ messages in thread
From: John Hendy @ 2013-05-07 21:34 UTC (permalink / raw)
  To: Bastien; +Cc: Jisang Yoo, emacs-orgmode

On Tue, May 7, 2013 at 4:54 AM, Bastien <bzg@gnu.org> wrote:
> Hi John,
>
> John Hendy <jw.hendy@gmail.com> writes:
>
>> On Fri, Apr 26, 2013 at 1:54 AM, Bastien <bzg@gnu.org> wrote:
>>> Hi Jisang,
>>>
>>> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>>>
>>>> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
>>>> a first-level heading.
>>>
>>> This should now be fixed.  Thanks for reporting this,
>>
>> There were some same/similar/related issues as well, and I'm still not
>> getting perfect results.
>>
>> Using a minimal config (below), if I create this in a new file
>>
>> * test
>> ** test1
>> ** test2
>>
>> and then fold on * test, I get this:
>>
>> * test...2
>
> I do have (setq require-final-newline t) in my config, which prevents
> this.  What happens is this: if you don't have the config above, the
> folding will get wrong and display the "2" from the end of the buffer.
>
>> Also, after navigating to the end of * test...2 (with it folded) and
>> issuing M-RET, I get a new second level heading after ** test2. I
>> would have expected a new first level headline since I did M-RET on a
>> first level headline. Or is that the default behavior?
>
> If you are before the "..." ellipsis, you are on a first level
> headline and M-RET will insert a first level headline.  Otherwise you
> are on a second level headline ("test2") and it will insert a second
> level headline.

Ah, that now makes sense. But... just to be clear, take this case:

* Headline1
- list1
- list2

Now fold it:

* Headline1<cursor>...

If I do M-RET at <cursor>, I get:

* Headline1
* <cursor>
- list1
- list2

Is that how it's supposed to work? My use case is generally to have a
new headline after * Headline1 *and* it's contents, not putting
contents inside the new headline.

C-RET seems to behave more like I'd expect. In reading the manual, I
think I was just confused on usage based on the definition of C-RET,
however this in the description of M-RET is confusing:

#+begin_quote
If the command is used at the end of a folded subtree (i.e., behind
the ellipses at the end of a headline), then a headline like the
current one will be inserted after the end of the subtree. Calling
this command with C-u C-u will unconditionally respect the headline's
content and create a new item at the end of the parent subtree.
#+end_quote

It makes it seem like my original case in which the cursor is behind
(after?) the ... should insert a same-level headline after the end of
the current subtree (which I would assume means that headline and all
contents). Am I reading that incorrectly? It doesn't really talk about
the behavior if you're before the ellipsis.


Thanks for clarifying,
John

>
>> If so, I guess my only concern is the folding of the end of a headline
>> if there's no hard return after it into the ellipsis of it's parent.
>
> Yes.  Maybe M-RET could/should handle this corner-case but since
> `org-insert-heading' is deserving a full rewrite, I'm not going to
> try to handle this corner-case myself... let's just keep it in mind
> when doing the rewrite.  Thanks for spotting it,
>
> --
>  Bastien

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-05-07 21:34       ` John Hendy
@ 2013-05-10  6:49         ` Carsten Dominik
  2013-05-17 23:08           ` John Hendy
  0 siblings, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2013-05-10  6:49 UTC (permalink / raw)
  To: John Hendy; +Cc: Bastien, emacs-orgmode, Jisang Yoo


On 7.5.2013, at 23:34, John Hendy <jw.hendy@gmail.com> wrote:

> On Tue, May 7, 2013 at 4:54 AM, Bastien <bzg@gnu.org> wrote:
>> Hi John,
>> 
>> John Hendy <jw.hendy@gmail.com> writes:
>> 
>>> On Fri, Apr 26, 2013 at 1:54 AM, Bastien <bzg@gnu.org> wrote:
>>>> Hi Jisang,
>>>> 
>>>> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>>>> 
>>>>> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
>>>>> a first-level heading.
>>>> 
>>>> This should now be fixed.  Thanks for reporting this,
>>> 
>>> There were some same/similar/related issues as well, and I'm still not
>>> getting perfect results.
>>> 
>>> Using a minimal config (below), if I create this in a new file
>>> 
>>> * test
>>> ** test1
>>> ** test2
>>> 
>>> and then fold on * test, I get this:
>>> 
>>> * test...2
>> 
>> I do have (setq require-final-newline t) in my config, which prevents
>> this.  What happens is this: if you don't have the config above, the
>> folding will get wrong and display the "2" from the end of the buffer.
>> 
>>> Also, after navigating to the end of * test...2 (with it folded) and
>>> issuing M-RET, I get a new second level heading after ** test2. I
>>> would have expected a new first level headline since I did M-RET on a
>>> first level headline. Or is that the default behavior?
>> 
>> If you are before the "..." ellipsis, you are on a first level
>> headline and M-RET will insert a first level headline.  Otherwise you
>> are on a second level headline ("test2") and it will insert a second
>> level headline.
> 
> Ah, that now makes sense. But... just to be clear, take this case:
> 
> * Headline1
> - list1
> - list2
> 
> Now fold it:
> 
> * Headline1<cursor>...
> 
> If I do M-RET at <cursor>, I get:
> 
> * Headline1
> * <cursor>
> - list1
> - list2
> 
> Is that how it's supposed to work? My use case is generally to have a
> new headline after * Headline1 *and* it's contents, not putting
> contents inside the new headline.
> 
> C-RET seems to behave more like I'd expect. In reading the manual, I
> think I was just confused on usage based on the definition of C-RET,
> however this in the description of M-RET is confusing:
> 
> #+begin_quote
> If the command is used at the end of a folded subtree (i.e., behind
> the ellipses at the end of a headline), then a headline like the
> current one will be inserted after the end of the subtree. Calling
> this command with C-u C-u will unconditionally respect the headline's
> content and create a new item at the end of the parent subtree.
> #+end_quote
> 
> It makes it seem like my original case in which the cursor is behind
> (after?) the ... should insert a same-level headline after the end of
> the current subtree (which I would assume means that headline and all
> contents). Am I reading that incorrectly? It doesn't really talk about
> the behavior if you're before the ellipsis.

Yes, this is also a bit confusing.  I think it would be desirable if it
worked as described in the manual, but this is not what is happening.
For now, I fixed the manual.

- Carsten


> 
> 
> Thanks for clarifying,
> John
> 
>> 
>>> If so, I guess my only concern is the folding of the end of a headline
>>> if there's no hard return after it into the ellipsis of it's parent.
>> 
>> Yes.  Maybe M-RET could/should handle this corner-case but since
>> `org-insert-heading' is deserving a full rewrite, I'm not going to
>> try to handle this corner-case myself... let's just keep it in mind
>> when doing the rewrite.  Thanks for spotting it,
>> 
>> --
>> Bastien
> 

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

* Re: M-RET inside the first second-level heading of the first first-level heading
  2013-05-10  6:49         ` Carsten Dominik
@ 2013-05-17 23:08           ` John Hendy
  0 siblings, 0 replies; 9+ messages in thread
From: John Hendy @ 2013-05-17 23:08 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bastien, emacs-orgmode, Jisang Yoo

On Fri, May 10, 2013 at 1:49 AM, Carsten Dominik
<carsten.dominik@gmail.com> wrote:
>
> On 7.5.2013, at 23:34, John Hendy <jw.hendy@gmail.com> wrote:
>
>> On Tue, May 7, 2013 at 4:54 AM, Bastien <bzg@gnu.org> wrote:
>>> Hi John,
>>>
>>> John Hendy <jw.hendy@gmail.com> writes:
>>>
>>>> On Fri, Apr 26, 2013 at 1:54 AM, Bastien <bzg@gnu.org> wrote:
>>>>> Hi Jisang,
>>>>>
>>>>> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>>>>>
>>>>>> 2. Place cursor at the beginning of "** bacon" and press M-RET and org creates
>>>>>> a first-level heading.
>>>>>
>>>>> This should now be fixed.  Thanks for reporting this,
>>>>
>>>> There were some same/similar/related issues as well, and I'm still not
>>>> getting perfect results.
>>>>
>>>> Using a minimal config (below), if I create this in a new file
>>>>
>>>> * test
>>>> ** test1
>>>> ** test2
>>>>
>>>> and then fold on * test, I get this:
>>>>
>>>> * test...2
>>>
>>> I do have (setq require-final-newline t) in my config, which prevents
>>> this.  What happens is this: if you don't have the config above, the
>>> folding will get wrong and display the "2" from the end of the buffer.
>>>
>>>> Also, after navigating to the end of * test...2 (with it folded) and
>>>> issuing M-RET, I get a new second level heading after ** test2. I
>>>> would have expected a new first level headline since I did M-RET on a
>>>> first level headline. Or is that the default behavior?
>>>
>>> If you are before the "..." ellipsis, you are on a first level
>>> headline and M-RET will insert a first level headline.  Otherwise you
>>> are on a second level headline ("test2") and it will insert a second
>>> level headline.
>>
>> Ah, that now makes sense. But... just to be clear, take this case:
>>
>> * Headline1
>> - list1
>> - list2
>>
>> Now fold it:
>>
>> * Headline1<cursor>...
>>
>> If I do M-RET at <cursor>, I get:
>>
>> * Headline1
>> * <cursor>
>> - list1
>> - list2
>>
>> Is that how it's supposed to work? My use case is generally to have a
>> new headline after * Headline1 *and* it's contents, not putting
>> contents inside the new headline.
>>
>> C-RET seems to behave more like I'd expect. In reading the manual, I
>> think I was just confused on usage based on the definition of C-RET,
>> however this in the description of M-RET is confusing:
>>
>> #+begin_quote
>> If the command is used at the end of a folded subtree (i.e., behind
>> the ellipses at the end of a headline), then a headline like the
>> current one will be inserted after the end of the subtree. Calling
>> this command with C-u C-u will unconditionally respect the headline's
>> content and create a new item at the end of the parent subtree.
>> #+end_quote
>>
>> It makes it seem like my original case in which the cursor is behind
>> (after?) the ... should insert a same-level headline after the end of
>> the current subtree (which I would assume means that headline and all
>> contents). Am I reading that incorrectly? It doesn't really talk about
>> the behavior if you're before the ellipsis.
>
> Yes, this is also a bit confusing.  I think it would be desirable if it
> worked as described in the manual, but this is not what is happening.
> For now, I fixed the manual.
>

Much appreciated, and I'll be following the other M-RET and C-RET
thread as it seems some of this behavior will change in the near
future.


Thanks!
John

> - Carsten
>
>
>>
>>
>> Thanks for clarifying,
>> John
>>
>>>
>>>> If so, I guess my only concern is the folding of the end of a headline
>>>> if there's no hard return after it into the ellipsis of it's parent.
>>>
>>> Yes.  Maybe M-RET could/should handle this corner-case but since
>>> `org-insert-heading' is deserving a full rewrite, I'm not going to
>>> try to handle this corner-case myself... let's just keep it in mind
>>> when doing the rewrite.  Thanks for spotting it,
>>>
>>> --
>>> Bastien
>>
>

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

end of thread, other threads:[~2013-05-17 23:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-25 20:39 M-RET inside the first second-level heading of the first first-level heading Jisang Yoo
2013-04-25 21:51 ` John Hendy
2013-04-26  6:54 ` Bastien
2013-05-02 18:51   ` John Hendy
2013-05-02 18:52     ` John Hendy
2013-05-07  9:54     ` Bastien
2013-05-07 21:34       ` John Hendy
2013-05-10  6:49         ` Carsten Dominik
2013-05-17 23:08           ` John Hendy

Code repositories for project(s) associated with this 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).