From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-insert-heading rewritten from scratch Date: Sun, 1 Sep 2013 08:13:47 +0200 Message-ID: References: <6570EFE0-1DCA-44D1-AAD9-BE51A278EE58@gmail.com> <87txj0d3y8.fsf@ericabrahamsen.net> <2CBE3492-5A45-48D6-AF3B-A81D0C322009@gmail.com> <877gf2nd2y.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG0v4-0004bg-NQ for emacs-orgmode@gnu.org; Sun, 01 Sep 2013 02:14:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VG0uy-0001oQ-Vq for emacs-orgmode@gnu.org; Sun, 01 Sep 2013 02:13:54 -0400 Received: from mail-ee0-x233.google.com ([2a00:1450:4013:c00::233]:41691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VG0uy-0001oE-NY for emacs-orgmode@gnu.org; Sun, 01 Sep 2013 02:13:48 -0400 Received: by mail-ee0-f51.google.com with SMTP id c1so1688353eek.10 for ; Sat, 31 Aug 2013 23:13:46 -0700 (PDT) In-Reply-To: <877gf2nd2y.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: Eric Abrahamsen , emacs-orgmode@gnu.org Hi Nicolas, On 31.8.2013, at 16:34, Nicolas Goaziou wrote: > Hello, >=20 > Carsten Dominik writes: >=20 >> On 8.8.2013, at 09:41, Eric Abrahamsen = wrote: >>=20 >>> Carsten Dominik writes: >>>=20 >>>> Hi, >>>>=20 >>>> 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. >>>>=20 >>>> - Carsten >>>=20 >>> Awesome! Thanks very much for doing this. Will report back with = bugs. >>=20 >> I take it none have been found? >=20 > 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: >=20 > XCursor is at "X" >=20 > 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? >=20 > 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'. >=20 > * H1 >=20 > Paragraph >=20 >=20 >=20 > * 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? >=20 > IMO, using M-RET and C-RET should be as smooth an experience as > possible. I fully agree. >=20 > 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