emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: James Harkins <jamshark70@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87k3qebvw4.fsf@bzg.ath.cx> (raw)
In-Reply-To: <874ni598fq.wl%jamshark70@dewdrop-world.net> (James Harkins's message of "Fri, 25 Jan 2013 12:46:01 +0800")

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

Hi James,

James Harkins <jamshark70@gmail.com> 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!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-mobile.el-org-mobile-edit-DTRT-when-insert-a-hea.patch --]
[-- Type: text/x-patch, Size: 1967 bytes --]

From 808779ada5a35b69aca12e35723b22725aebf0f3 Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
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


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2013-02-11 17:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25  4:46 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/)] James Harkins
2013-02-11 17:30 ` Bastien [this message]
2013-02-12  3:50   ` James Harkins
2013-02-12 10:34     ` Bastien
2013-02-14  9:09     ` Bastien
     [not found]       ` <CAFniQ7XpJnqOW8DqdGLJ1RbtPtrnKQz=zXBH-O0M1ZFPBa5ucw@mail.gmail.com>
     [not found]         ` <87mwujdp87.fsf@bzg.ath.cx>
2013-03-13  9:03           ` James Harkins
2013-04-10 23:06             ` 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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3qebvw4.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jamshark70@gmail.com \
    /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 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).