From: James Harkins <jamshark70@gmail.com>
To: Emacs-orgmode@gnu.org
Subject: [patch] org-mobile-edit: Fix "addheading" parent-level bug
Date: Wed, 30 Jan 2013 10:53:12 +0800 [thread overview]
Message-ID: <CAFniQ7X-TF4aF3S7V6-=SaxggH=+Js9CKB14-sBJfJM-PzjQJg@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2013-01-30 2:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 2:53 James Harkins [this message]
2013-03-04 17:44 ` [patch] org-mobile-edit: Fix "addheading" parent-level bug Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFniQ7X-TF4aF3S7V6-=SaxggH=+Js9CKB14-sBJfJM-PzjQJg@mail.gmail.com' \
--to=jamshark70@gmail.com \
--cc=Emacs-orgmode@gnu.org \
--cc=jamshark70@dewdrop-world.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.