From df8885c91a99d05224df98d2a86cd608f8c24ac1 Mon Sep 17 00:00:00 2001
From: James Harkins <jamshark70@dewdrop-world.net>
Date: Wed, 30 Jan 2013 10:40:35 +0800
Subject: [PATCH] Workaround for an issue causing new nodes to be added at the
 wrong level

Adding a new heading in MobileOrg uses
org-insert-heading-respect-content. This function does not behave
correctly if the parent node is invisible at the time of inserting the
new heading. The workaround is to call org-show-entry before
inserting. A better fix would be to make
org-insert-heading-respect-content do the right thing in all cases,
but that is likely to take some more time than avoiding the problem
here.

TINYCHANGE
---
 lisp/org-mobile.el |    1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index 5a3b27f..aded54a 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -1060,6 +1060,7 @@ be returned that indicates what went wrong."
      ((eq what 'addheading)
       (if (org-on-heading-p) ; if false we are in top-level of file
 	  (progn
+	    (org-show-entry)
 	    (end-of-line 1)
 	    (org-insert-heading-respect-content)
 	    (org-demote))
-- 
1.7.9.5

