From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Bug: org-insert-heading-respect-content inserts at the wrong level if target heading is invisible [7.9.2 (release_7.9.2-883-g6fb36e.dirty @ /home/dlm/share/org-mode.git/lisp/)] Date: Mon, 11 Feb 2013 18:30:51 +0100 Message-ID: <87k3qebvw4.fsf@bzg.ath.cx> References: <874ni598fq.wl%jamshark70@dewdrop-world.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4xDk-0001e3-6m for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 12:31:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4xDi-00075Q-Fx for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 12:31:12 -0500 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:59688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4xDi-000751-8R for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 12:31:10 -0500 Received: by mail-we0-f181.google.com with SMTP id t44so5011955wey.26 for ; Mon, 11 Feb 2013 09:31:09 -0800 (PST) In-Reply-To: <874ni598fq.wl%jamshark70@dewdrop-world.net> (James Harkins's message of "Fri, 25 Jan 2013 12:46:01 +0800") 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: James Harkins Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi James, James Harkins writes: > I'm resending the issue that I reported the other day, now with a > MCE. Sorry for the delay on this -- and thanks for the detailed reports. I tried not to get lost in the details actually... so I ended up using the attached fix. It works here, i.e. C-u C-RET inserts a new heading at the right place, but I'm not using org-mobile.el so I'm not 100% sure if it works for you. Can you test and confirm? Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-mobile.el-org-mobile-edit-DTRT-when-insert-a-hea.patch >From 808779ada5a35b69aca12e35723b22725aebf0f3 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 11 Feb 2013 18:27:21 +0100 Subject: [PATCH] Fix `org-insert-heading-respect-content' * org-mobile.el (org-mobile-edit): DTRT when insert a heading in an invisible region. * org.el (org-insert-heading-respect-content): New `invisible-ok' parameter. Add docstring. (org-insert-todo-heading-respect-content): Add docstring. Thanks to James Harkins for the extra detailed reports and the proposed solutions, both for org.el and org-mobile.el. --- lisp/org-mobile.el | 2 +- lisp/org.el | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el index a410de0..293d2a0 100644 --- a/lisp/org-mobile.el +++ b/lisp/org-mobile.el @@ -1064,7 +1064,7 @@ be returned that indicates what went wrong." (if (org-on-heading-p) ; if false we are in top-level of file (progn (end-of-line 1) - (org-insert-heading-respect-content) + (org-insert-heading-respect-content t) (org-demote)) (beginning-of-line) (insert "* ")) diff --git a/lisp/org.el b/lisp/org.el index 623c374..10168a5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7231,12 +7231,14 @@ This is a list with the following elements: (org-move-subtree-down) (end-of-line 1)) -(defun org-insert-heading-respect-content () - (interactive) +(defun org-insert-heading-respect-content (invisible-ok) + "Insert heading with `org-insert-heading-respect-content' set to t." + (interactive "P") (let ((org-insert-heading-respect-content t)) - (org-insert-heading t))) + (org-insert-heading t invisible-ok))) (defun org-insert-todo-heading-respect-content (&optional force-state) + "Insert TODO heading with `org-insert-heading-respect-content' set to t." (interactive "P") (let ((org-insert-heading-respect-content t)) (org-insert-todo-heading force-state t))) -- 1.8.1.2 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--