From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Bug: Append new heading when :END: exists Date: Mon, 22 Apr 2013 20:57:12 +0200 Message-ID: <87sj2io0l3.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UULvQ-00045M-JF for emacs-orgmode@gnu.org; Mon, 22 Apr 2013 14:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UULvP-00008O-Ak for emacs-orgmode@gnu.org; Mon, 22 Apr 2013 14:57:16 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:48658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UULvP-00007e-5D for emacs-orgmode@gnu.org; Mon, 22 Apr 2013 14:57:15 -0400 Received: by mail-wg0-f41.google.com with SMTP id e11so1144510wgh.4 for ; Mon, 22 Apr 2013 11:57:14 -0700 (PDT) In-Reply-To: (John Hendy's message of "Mon, 22 Apr 2013 07:01:11 -0500") 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: John Hendy Cc: emacs-orgmode , Muchenxuan Tong --=-=-= Content-Type: text/plain I'm tempted to apply the following patch, as this problem falls under the category of "inserting in an invisible region". I don't think it breaks any non-interactive call of org-insert-heading, but this needs further checking. Also, note that the problem occurs only when there is no blank line between the :END: and the following headline, so maybe the real fix has to be within org-insert-heading... --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=org.el.patch diff --git a/lisp/org.el b/lisp/org.el index 8c55bd4..4d16682 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7495,6 +7495,7 @@ and create a new headline with the text in the current line after point When INVISIBLE-OK is set, stop at invisible headlines when going back. This is important for non-interactive uses of the command." (interactive "P") + (org-check-before-invisible-edit 'insert) (cond ((or (= (buffer-size) 0) (and (not (save-excursion --=-=-= Content-Type: text/plain -- Bastien --=-=-=--