Hi Nicolas, On 31.8.2013, at 16:34, Nicolas Goaziou <n.goaz...@gmail.com> wrote:
> Hello, > > Carsten Dominik <carsten.domi...@gmail.com> writes: > >> On 8.8.2013, at 09:41, Eric Abrahamsen <e...@ericabrahamsen.net> wrote: >> >>> Carsten Dominik <carsten.domi...@gmail.com> writes: >>> >>>> Hi, >>>> >>>> I have rewritten org-insert-heading, because it had become an >>>> unmaintainable beast. >>>> Please follow up in this thread if you find problems with the new >>>> implementation. >>>> Very likely there will be bugs, but now I am at least confident they can >>>> be fixed. >>>> >>>> - Carsten >>> >>> Awesome! Thanks very much for doing this. Will report back with bugs. >> >> I take it none have been found? > > Not really a bug, but I find some behaviour surprising: when at a the > beginning of a regular text line, there is no way to create a headline > just above it. In the following example: > > XCursor is at "X" > > Neither M-RET, C-u M-RET, C-RET nor C-u C-RET can do it. Is it intended? Which behavior would you propose? I guess you mean that, at the beginning of a line, the result is so different for normal lines versus headlines? The way I was thinking about the behavior at the beginning of a non-headline is that it is the same as in the middle of a line: Take the rest of the line and turn it into a headline. To create a headline before a nonempty line, I use `C-o M-RET' To be sure: I am happy to change the behavior if that is what people want and if it makes logically sense. > Also in this case, I think C-RET should create the new headline _after_ > the subtree, since that's its whole point anyway, AFAIU. That is what happens for me. It does not for you? > > Eventually, it seems that behaviour towards empty lines is a bit > unpredictable. In the following example, M-RET will be behave > differently on each blank line between Paragraph and "H2". C-RET will be > consistent. Because it does what M-RET does in the last line of the subtree. > Note: I have `auto' as value for `heading' key in > `org-blank-before-new-entry'. > > * H1 > > Paragraph > > > > * H2 Hmm, I do find this behavior consistent. M-RET does not change the number of while lines after the current, only before, in order to either have an empty line or not. Which behavior would you propose? > > IMO, using M-RET and C-RET should be as smooth an experience as > possible. I fully agree. > > I also suggest to write function specifications as tests in test-org.el. Yes, I have yet to write my first test. Need to figure out how that works. - Carsten