Need a tldr here.... is the source of the problem within org-mode itself?
On Mon, Jan 21, 2013 at 6:08 AM, mobileorg-android on behalf of hjh <
mobileorg-android-/***@public.gmane.org> wrote:
> On 01/16/2013 04:09 PM, James Harkins wrote:
>
>>
>> So, I've been playing with this some more, and I'm pretty confused.
>>
>> I started looking at org-mobile-apply, and found some variables that I
>> thought would indicate the beginning and ending of the parent node
>> specified in a mobileorg.org entry:
>>
>> (id-pos (condition-case msg
>> (org-mobile-locate-entry (match-string 4))
>> (error (nth 1 msg))))
>> (bos (point-at-bol))
>> (eos (save-excursion (org-end-of-subtree t t)))
>>
>
> Less confused... bos and eos are positions within from-mobileorg.org, not
> the target org file.
>
> More good stuff: one detail point, and a significant result from edebug.
>
> The point of detail: If I cycle global visibility in the org buffer that
> will be edited by org mobile pull so that everything is visible, then I
> can't reproduce the bug anymore.
>
> 1. On the mobile, add a node under one of my failing cases. Sync.
> 2. In emacs, cycle global visibility to show top-level nodes only.
> 3. Org mobile pull puts the new node in the wrong place.
> 4. Same as 1.
> 5. Same as 2, but *show* everything (instead of hiding as much as
> possible).
> 6. Org mobile pull puts the new node in the *right* place.
>
> So, something confuses it when content is hidden.
>
> With source level debugging, I can pinpoint where the problem occurs -- in
> org-mobile-edit:
>
> ((eq what 'addheading)
> (if (org-on-heading-p) ; if false we are in top-level of file
> (progn
> (end-of-line 1)
>
> ;; RIGHT HERE
> (org-insert-heading-respect-**content)
>
> (org-demote))
> (beginning-of-line)
> (insert "* "))
> (insert new))
>
> Everything before this point appears to be kosher.
>
> Somewhere, org-insert-heading-respect-**content calls org-end-of-subtree.
> When the problem occurs, there are multiple calls to find the end of the
> subtree. In my test case, I added a new fourth-level heading underneath a
> third-level heading. During org-insert-heading-respect-**content's first
> call to org-end-of-subtree, the "level" identified* is correct = 3, AND the
> end of the subtree is correctly identified as the beginning of the next
> third-level heading. If it stopped there and inserted the new node at
> exactly that point, there would be no problem.
>
> * org-end-of-subtree identifies the level by (funcall outline-level).
> "Level" is not a defun argument.
>
> Then, somehow (which I haven't figured out), org-end-of-subtree is called
> again, but now the "level" is found to be 1, and it finds the beginning of
> the next first-level heading. Not coincidentally, this is exactly the place
> where the new fourth-level heading is added (but now it's magically changed
> into a second-level heading).
>
> Unfortunately, I've already spent way too much time trying to debug this
> and I really have to turn my attention seriously to some other projects.
> Since I have a test case that consistently reproduces the problem, I'm
> happy to run more tests, try patches etc. but I'm not able at this point to
> spend another 2-3 hours in a day to track the issue down. Still, narrowing
> the issue down to one specific function call in all of org-mobile.el should
> be a useful finding.
>
> (I wanted to add this to the bug tracker, but for some reason, I can't get
> to github right now...)
>
> Thanks,
>
> hjh
>
> --
> You received this message because you are subscribed to the Google Groups
> "mobileorg-android" group.
> To post to this group, send email to mobileorg-android@**googlegroups.com<mobileorg-android-/***@public.gmane.org>
> .
> To unsubscribe from this group, send email to
> mobileorg-android+unsubscribe@**googlegroups.com<mobileorg-android%2Bunsubscribe-/***@public.gmane.org>
> .
> For more options, visit this group at http://groups.google.com/**
> group/mobileorg-android?hl=en<http://groups.google.com/group/mobileorg-android?hl=en>
> .
>
>
--
You received this message because you are subscribed to the Google Groups "mobileorg-android" group.
To post to this group, send email to mobileorg-android-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to mobileorg-android+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/mobileorg-android?hl=en.