emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [patch] org-mobile-edit: Fix "addheading" parent-level bug
@ 2013-01-30  2:53 James Harkins
  2013-03-04 17:44 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: James Harkins @ 2013-01-30  2:53 UTC (permalink / raw)
  To: Emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]

I've sent some messages to this list about a bug that manifests in
org-mobile (although the cause is in orgmode itself, and is not
specific to org-mobile). One of those messages is a bug report, with
steps to reproduce that do not depend on having MobileOrg set up (so
anyone can look at it, not only MobileOrg users). The bug report
hasn't been processed yet, though (I assume because Bastien and others
are busy).

This is a pretty serious issue for MobileOrg users, so... I have a
workaround, in the attached patch. Tested and works.

I call it a workaround because it doesn't actually fix the root
problem, which is that org-insert-heading-respect-content doesn't do
the right thing when called non-interactively on an invisible heading.
If someone writes a clever lisp function that uses
org-insert-heading-respect-content without explicitly showing the
entry, she will run into the same problem that MobileOrg has now. So
this does not supersede the bug report. It's just a band-aid so that
MobileOrg users' outline structures don't get corrupted when syncing
new nodes from the mobile into Emacs. Unfortunately, I've taken the
issue as far as I can and I just don't understand where
org-insert-heading is going wrong. In any case, corruption of the
outline structure is reason enough to apply the workaround without
waiting for a "real" fix.

hjh

-- 
James Harkins /// dewdrop world
jamshark70@dewdrop-world.net
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

blog: http://www.dewdrop-world.net/words
audio clips: http://www.dewdrop-world.net/audio
more audio: http://soundcloud.com/dewdrop_world/tracks

[-- Attachment #2: 0001-Workaround-for-an-issue-causing-new-nodes-to-be-adde.patch --]
[-- Type: application/octet-stream, Size: 1180 bytes --]

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] org-mobile-edit: Fix "addheading" parent-level bug
  2013-01-30  2:53 [patch] org-mobile-edit: Fix "addheading" parent-level bug James Harkins
@ 2013-03-04 17:44 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-03-04 17:44 UTC (permalink / raw)
  To: jamshark70; +Cc: Emacs-orgmode

Hi James,

I implemented the workaround for now, as there are still some issues 
with `org-insert-heading' in invisible part of a subtree.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-04 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-30  2:53 [patch] org-mobile-edit: Fix "addheading" parent-level bug James Harkins
2013-03-04 17:44 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).