emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix Subtle Heading Creation Bugs
@ 2008-10-18  0:10 Peter Jones
  2008-10-18  6:01 ` Carsten Dominik
  2008-10-22  6:02 ` [PATCH] " Carsten Dominik
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Jones @ 2008-10-18  0:10 UTC (permalink / raw)
  To: emacs-orgmode

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


Since commit 238d0d1 (Improve consistency for inserting new headlines)
a few minor inconsistencies were introduced to heading creation with
the control key, A.K.A. org-insert-heading-respect-content.  This
patch resolves those subtle "bugs".

This patch changes org-insert-heading-respect-content so that it:

 - Creates a new heading even if point is in a plain list
   (force-heading is set to true, behavior before 238d0d1)
 - If the previous heading was closed, keep it closed
   (keeps the previous heading in the state it was before C-RET)

It also includes changes for org-insert-todo-heading and the OrgMode
manual.

Thanks Carsten for making the changes in 238d0d1 for me.  With the
attached patch, heading creation is now perfect (for me at least ;).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: heading.patch --]
[-- Type: text/x-patch, Size: 4784 bytes --]

From 200826587af4bd40995d1d45381006ed0639f7e9 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@pmade.com>
Date: Fri, 17 Oct 2008 17:26:11 -0600
Subject: [PATCH] Fix Subtle Heading Creation Bugs

Since commit 238d0d1 (Improve consistency for inserting new headlines)
a few minor inconsistencies were introduced to heading creation with
the control key, A.K.A. org-insert-heading-respect-content.  This
patch resolves those subtle "bugs".

This patch changes org-insert-heading-respect-content so that it:

 - Creates a new heading even if point is in a plain list
   (force-heading is set to true, behavior before 238d0d1)
 - If the previous heading was closed, keep it closed
   (keeps the previous heading in the state it was before C-RET)
---
 lisp/org.el |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9c08ba4..541cf3a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4607,7 +4607,7 @@ but create the new hedline after the current line."
 			   (match-string 0))
 		       (error "*"))))
 	     (blank (cdr (assq 'heading org-blank-before-new-entry)))
-	     pos)
+	     pos should-hide-previous-heading)
 	(cond
 	 ((and (org-on-heading-p) (bolp)
 	       (or (bobp)
@@ -4622,6 +4622,9 @@ but create the new hedline after the current line."
 	  nil)
 	 (t
 	  ;; in the middle of the line
+          (save-excursion
+            (end-of-line)
+            (setq should-hide-previous-heading (org-invisible-p)))
 	  (org-show-entry)
 	  (let ((split
 		 (org-get-alist-option org-M-RET-may-split-line 'headline))
@@ -4652,6 +4655,10 @@ but create the new hedline after the current line."
 	(setq pos (point))
 	(end-of-line 1)
 	(unless (= (point) pos) (just-one-space) (backward-delete-char 1))
+        (when (and org-insert-heading-respect-content should-hide-previous-heading)
+            (save-excursion
+              (outline-previous-visible-heading 1)
+              (hide-entry)))
 	(run-hooks 'org-insert-heading-hook)))))
 
 (defun org-get-heading (&optional no-tags)
@@ -4675,7 +4682,7 @@ but create the new hedline after the current line."
 (defun org-insert-heading-respect-content ()
   (interactive)
   (let ((org-insert-heading-respect-content t))
-    (call-interactively 'org-insert-heading)))
+    (org-insert-heading t)))
 
 (defun org-insert-todo-heading-respect-content ()
   (interactive)
-- 
1.6.0


From e7de89ce7a1bd3ab2259159fdb65b052d74370a0 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@pmade.com>
Date: Fri, 17 Oct 2008 17:57:47 -0600
Subject: [PATCH] Update documentation WRT C-RET

---
 doc/org.texi |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 31996e0..b76fcaf 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -897,8 +897,9 @@ of a headline), then a headline like the current one will be inserted
 after the end of the subtree.
 @kindex C-@key{RET}
 @item C-@key{RET}
-Just like @kbd{M-@key{RET}}, but if the heading is inserted after the current,
-insert it actually after the entire subtree.
+Just like @kbd{M-@key{RET}}, except when adding a new heading below the
+current heading, the new heading is placed after the body instead of before
+it.  This command works from anywhere in the entry.
 @kindex M-S-@key{RET}
 @item M-S-@key{RET}
 Insert new TODO entry with same level as current heading.
-- 
1.6.0


From 4f7aed562ae93759fb1638378029aeef3cc70e79 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@pmade.com>
Date: Fri, 17 Oct 2008 18:03:38 -0600
Subject: [PATCH] Also fix org-insert-todo-heading

---
 lisp/org.el |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 541cf3a..5e4d6a5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4684,18 +4684,18 @@ but create the new hedline after the current line."
   (let ((org-insert-heading-respect-content t))
     (org-insert-heading t)))
 
-(defun org-insert-todo-heading-respect-content ()
-  (interactive)
+(defun org-insert-todo-heading-respect-content (force-state)
+  (interactive "P")
   (let ((org-insert-heading-respect-content t))
-    (call-interactively 'org-insert-todo-heading)))
+    (org-insert-todo-heading force-state t)))
 
-(defun org-insert-todo-heading (arg)
+(defun org-insert-todo-heading (arg &optional force-heading)
   "Insert a new heading with the same level and TODO state as current heading.
 If the heading has no TODO state, or if the state is DONE, use the first
 state (TODO by default).  Also with prefix arg, force first state."
   (interactive "P")
   (when (not (org-insert-item 'checkbox))
-    (org-insert-heading)
+    (org-insert-heading force-heading)
     (save-excursion
       (org-back-to-heading)
       (outline-previous-heading)
-- 
1.6.0


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


-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [PATCH] Fix Subtle Heading Creation Bugs
  2008-10-18  0:10 [PATCH] Fix Subtle Heading Creation Bugs Peter Jones
@ 2008-10-18  6:01 ` Carsten Dominik
  2008-10-18 15:24   ` Peter Jones
  2008-10-22  6:02 ` [PATCH] " Carsten Dominik
  1 sibling, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2008-10-18  6:01 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode

Hi Peter,

thanks for the patches.

I certainly like the change re-hiding a folded headline.

I am not so sure about forcing headline creation even when in a plain  
list item.  I can see why you would want it like this.  However, the  
reason for the current behavior is that then you can use the respect- 
content function as a full replacement for M-RET, without the need to  
always switch back and force between the two commands.

Any thought about this?

- Carsten

On Oct 18, 2008, at 2:10 AM, Peter Jones wrote:

>
> Since commit 238d0d1 (Improve consistency for inserting new headlines)
> a few minor inconsistencies were introduced to heading creation with
> the control key, A.K.A. org-insert-heading-respect-content.  This
> patch resolves those subtle "bugs".
>
> This patch changes org-insert-heading-respect-content so that it:
>
> - Creates a new heading even if point is in a plain list
>   (force-heading is set to true, behavior before 238d0d1)
> - If the previous heading was closed, keep it closed
>   (keeps the previous heading in the state it was before C-RET)
>
> It also includes changes for org-insert-todo-heading and the OrgMode
> manual.
>
> Thanks Carsten for making the changes in 238d0d1 for me.  With the
> attached patch, heading creation is now perfect (for me at least ;).
>
> From 200826587af4bd40995d1d45381006ed0639f7e9 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Fri, 17 Oct 2008 17:26:11 -0600
> Subject: [PATCH] Fix Subtle Heading Creation Bugs
>
> Since commit 238d0d1 (Improve consistency for inserting new headlines)
> a few minor inconsistencies were introduced to heading creation with
> the control key, A.K.A. org-insert-heading-respect-content.  This
> patch resolves those subtle "bugs".
>
> This patch changes org-insert-heading-respect-content so that it:
>
> - Creates a new heading even if point is in a plain list
>   (force-heading is set to true, behavior before 238d0d1)
> - If the previous heading was closed, keep it closed
>   (keeps the previous heading in the state it was before C-RET)
> ---
> lisp/org.el |   11 +++++++++--
> 1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 9c08ba4..541cf3a 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -4607,7 +4607,7 @@ but create the new hedline after the current  
> line."
> 			   (match-string 0))
> 		       (error "*"))))
> 	     (blank (cdr (assq 'heading org-blank-before-new-entry)))
> -	     pos)
> +	     pos should-hide-previous-heading)
> 	(cond
> 	 ((and (org-on-heading-p) (bolp)
> 	       (or (bobp)
> @@ -4622,6 +4622,9 @@ but create the new hedline after the current  
> line."
> 	  nil)
> 	 (t
> 	  ;; in the middle of the line
> +          (save-excursion
> +            (end-of-line)
> +            (setq should-hide-previous-heading (org-invisible-p)))
> 	  (org-show-entry)
> 	  (let ((split
> 		 (org-get-alist-option org-M-RET-may-split-line 'headline))
> @@ -4652,6 +4655,10 @@ but create the new hedline after the current  
> line."
> 	(setq pos (point))
> 	(end-of-line 1)
> 	(unless (= (point) pos) (just-one-space) (backward-delete-char 1))
> +        (when (and org-insert-heading-respect-content should-hide- 
> previous-heading)
> +            (save-excursion
> +              (outline-previous-visible-heading 1)
> +              (hide-entry)))
> 	(run-hooks 'org-insert-heading-hook)))))
>
> (defun org-get-heading (&optional no-tags)
> @@ -4675,7 +4682,7 @@ but create the new hedline after the current  
> line."
> (defun org-insert-heading-respect-content ()
>   (interactive)
>   (let ((org-insert-heading-respect-content t))
> -    (call-interactively 'org-insert-heading)))
> +    (org-insert-heading t)))
>
> (defun org-insert-todo-heading-respect-content ()
>   (interactive)
> -- 
> 1.6.0
>
>
> From e7de89ce7a1bd3ab2259159fdb65b052d74370a0 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Fri, 17 Oct 2008 17:57:47 -0600
> Subject: [PATCH] Update documentation WRT C-RET
>
> ---
> doc/org.texi |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index 31996e0..b76fcaf 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -897,8 +897,9 @@ of a headline), then a headline like the current  
> one will be inserted
> after the end of the subtree.
> @kindex C-@key{RET}
> @item C-@key{RET}
> -Just like @kbd{M-@key{RET}}, but if the heading is inserted after  
> the current,
> -insert it actually after the entire subtree.
> +Just like @kbd{M-@key{RET}}, except when adding a new heading below  
> the
> +current heading, the new heading is placed after the body instead  
> of before
> +it.  This command works from anywhere in the entry.
> @kindex M-S-@key{RET}
> @item M-S-@key{RET}
> Insert new TODO entry with same level as current heading.
> -- 
> 1.6.0
>
>
> From 4f7aed562ae93759fb1638378029aeef3cc70e79 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Fri, 17 Oct 2008 18:03:38 -0600
> Subject: [PATCH] Also fix org-insert-todo-heading
>
> ---
> lisp/org.el |   10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 541cf3a..5e4d6a5 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -4684,18 +4684,18 @@ but create the new hedline after the current  
> line."
>   (let ((org-insert-heading-respect-content t))
>     (org-insert-heading t)))
>
> -(defun org-insert-todo-heading-respect-content ()
> -  (interactive)
> +(defun org-insert-todo-heading-respect-content (force-state)
> +  (interactive "P")
>   (let ((org-insert-heading-respect-content t))
> -    (call-interactively 'org-insert-todo-heading)))
> +    (org-insert-todo-heading force-state t)))
>
> -(defun org-insert-todo-heading (arg)
> +(defun org-insert-todo-heading (arg &optional force-heading)
>   "Insert a new heading with the same level and TODO state as  
> current heading.
> If the heading has no TODO state, or if the state is DONE, use the  
> first
> state (TODO by default).  Also with prefix arg, force first state."
>   (interactive "P")
>   (when (not (org-insert-item 'checkbox))
> -    (org-insert-heading)
> +    (org-insert-heading force-heading)
>     (save-excursion
>       (org-back-to-heading)
>       (outline-previous-heading)
> -- 
> 1.6.0
>
>
> -- 
> Peter Jones, http://pmade.com
> pmade inc.  Louisville, CO US
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Fix Subtle Heading Creation Bugs
  2008-10-18  6:01 ` Carsten Dominik
@ 2008-10-18 15:24   ` Peter Jones
  2008-10-18 17:59     ` Manish
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Jones @ 2008-10-18 15:24 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:
> I am not so sure about forcing headline creation even when in a plain
> list item.  I can see why you would want it like this.  However, the
> reason for the current behavior is that then you can use the respect- 
> content function as a full replacement for M-RET, without the need to
> always switch back and force between the two commands.
>
> Any thought about this?

My position is that I want both features, and I have two key bindings,
so it's a perfect match.

The way I work is that I use C-RET for creating headings, and M-RET for
creating plain lists.  I never use M-RET for creating headings because I
don't like how it creates the heading above the body of the current
item.

I could set org-insert-heading-respect-content to t, but it makes more
sense in my head that M-RET is for plain lists, and C-RET is for
headings.

Before my patch, C-RET and M-RET only differed in where the heading was
created (before or after the body).  But the original behavior of
OrgMode was that M-RET in a plain list created a new plain list item,
while C-RET in a plain list would create a new heading.

However, this could all be chalked up to me being lazy.  I could just as
easily do this in a plain list instead: RET C-RET.  Well, except that
with my patch, C-RET will create a new heading, even if point is in a
drawer or something like a clock line.  In that case I could do C-u
C-RET.  

I just like the path of least resistance for creating new headings,
C-RET.  If this isn't good for OrgMode in general, I can easily bind C-j
to do what I want as well.

Thanks.

-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

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

* Re: Re: Fix Subtle Heading Creation Bugs
  2008-10-18 15:24   ` Peter Jones
@ 2008-10-18 17:59     ` Manish
  0 siblings, 0 replies; 7+ messages in thread
From: Manish @ 2008-10-18 17:59 UTC (permalink / raw)
  To: Carsten Dominik, emacs-orgmode

  On Sat, Oct 18, 2008 at 8:54 PM, Peter Jones wrote:
  > Carsten Dominik writes:
  >> I am not so sure about forcing headline creation even when in a plain
  >> list item.  I can see why you would want it like this.  However, the
  >> reason for the current behavior is that then you can use the respect-
  >> content function as a full replacement for M-RET, without the need to
  >> always switch back and force between the two commands.
  >>
  >> Any thought about this?
  >
  > My position is that I want both features, and I have two key bindings,
  > so it's a perfect match.
  >
  > The way I work is that I use C-RET for creating headings, and M-RET for
  > creating plain lists.  I never use M-RET for creating headings because I
  > don't like how it creates the heading above the body of the current
  > item.
  >
  > I could set org-insert-heading-respect-content to t, but it makes more
  > sense in my head that M-RET is for plain lists, and C-RET is for
  > headings.
  >
  > Before my patch, C-RET and M-RET only differed in where the heading was
  > created (before or after the body).  But the original behavior of
  > OrgMode was that M-RET in a plain list created a new plain list item,
  > while C-RET in a plain list would create a new heading.
  >
  > However, this could all be chalked up to me being lazy.  I could just as
  > easily do this in a plain list instead: RET C-RET.  Well, except that
  > with my patch, C-RET will create a new heading, even if point is in a
  > drawer or something like a clock line.  In that case I could do C-u
  > C-RET.
  >
  > I just like the path of least resistance for creating new headings,
  > C-RET.  If this isn't good for OrgMode in general, I can easily bind C-j
  > to do what I want as well.

I liked Peter's description, tried his patch and find C-Ret and M-Ret
behaviour better now.  Earlier C-Ret and M-Ret had same effects (in my
setup) but makes better sense (to me) after the patch.  Just a humble
opinion.

-- 
Manish

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

* Re: [PATCH] Fix Subtle Heading Creation Bugs
  2008-10-18  0:10 [PATCH] Fix Subtle Heading Creation Bugs Peter Jones
  2008-10-18  6:01 ` Carsten Dominik
@ 2008-10-22  6:02 ` Carsten Dominik
  2008-10-23  0:30   ` Peter Jones
  1 sibling, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2008-10-22  6:02 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 6353 bytes --]

Hi Peter,

I have applied your full patch, thanks.

Please verify the push, I did have a little technical problem when  
applying, so please make sure it worked correctly.

Thanks.

- Carsten
On Oct 18, 2008, at 2:10 AM, Peter Jones wrote:

>
> Since commit 238d0d1 (Improve consistency for inserting new headlines)
> a few minor inconsistencies were introduced to heading creation with
> the control key, A.K.A. org-insert-heading-respect-content.  This
> patch resolves those subtle "bugs".
>
> This patch changes org-insert-heading-respect-content so that it:
>
> - Creates a new heading even if point is in a plain list
>   (force-heading is set to true, behavior before 238d0d1)
> - If the previous heading was closed, keep it closed
>   (keeps the previous heading in the state it was before C-RET)
>
> It also includes changes for org-insert-todo-heading and the OrgMode
> manual.
>
> Thanks Carsten for making the changes in 238d0d1 for me.  With the
> attached patch, heading creation is now perfect (for me at least ;).
>
> From 200826587af4bd40995d1d45381006ed0639f7e9 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Fri, 17 Oct 2008 17:26:11 -0600
> Subject: [PATCH] Fix Subtle Heading Creation Bugs
>
> Since commit 238d0d1 (Improve consistency for inserting new headlines)
> a few minor inconsistencies were introduced to heading creation with
> the control key, A.K.A. org-insert-heading-respect-content.  This
> patch resolves those subtle "bugs".
>
> This patch changes org-insert-heading-respect-content so that it:
>
> - Creates a new heading even if point is in a plain list
>   (force-heading is set to true, behavior before 238d0d1)
> - If the previous heading was closed, keep it closed
>   (keeps the previous heading in the state it was before C-RET)
> ---
> lisp/org.el |   11 +++++++++--
> 1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 9c08ba4..541cf3a 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -4607,7 +4607,7 @@ but create the new hedline after the current  
> line."
> 			   (match-string 0))
> 		       (error "*"))))
> 	     (blank (cdr (assq 'heading org-blank-before-new-entry)))
> -	     pos)
> +	     pos should-hide-previous-heading)
> 	(cond
> 	 ((and (org-on-heading-p) (bolp)
> 	       (or (bobp)
> @@ -4622,6 +4622,9 @@ but create the new hedline after the current  
> line."
> 	  nil)
> 	 (t
> 	  ;; in the middle of the line
> +          (save-excursion
> +            (end-of-line)
> +            (setq should-hide-previous-heading (org-invisible-p)))
> 	  (org-show-entry)
> 	  (let ((split
> 		 (org-get-alist-option org-M-RET-may-split-line 'headline))
> @@ -4652,6 +4655,10 @@ but create the new hedline after the current  
> line."
> 	(setq pos (point))
> 	(end-of-line 1)
> 	(unless (= (point) pos) (just-one-space) (backward-delete-char 1))
> +        (when (and org-insert-heading-respect-content should-hide- 
> previous-heading)
> +            (save-excursion
> +              (outline-previous-visible-heading 1)
> +              (hide-entry)))
> 	(run-hooks 'org-insert-heading-hook)))))
>
> (defun org-get-heading (&optional no-tags)
> @@ -4675,7 +4682,7 @@ but create the new hedline after the current  
> line."
> (defun org-insert-heading-respect-content ()
>   (interactive)
>   (let ((org-insert-heading-respect-content t))
> -    (call-interactively 'org-insert-heading)))
> +    (org-insert-heading t)))
>
> (defun org-insert-todo-heading-respect-content ()
>   (interactive)
> -- 
> 1.6.0
>
>
> From e7de89ce7a1bd3ab2259159fdb65b052d74370a0 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Fri, 17 Oct 2008 17:57:47 -0600
> Subject: [PATCH] Update documentation WRT C-RET
>
> ---
> doc/org.texi |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index 31996e0..b76fcaf 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -897,8 +897,9 @@ of a headline), then a headline like the current  
> one will be inserted
> after the end of the subtree.
> @kindex C-@key{RET}
> @item C-@key{RET}
> -Just like @kbd{M-@key{RET}}, but if the heading is inserted after  
> the current,
> -insert it actually after the entire subtree.
> +Just like @kbd{M-@key{RET}}, except when adding a new heading below  
> the
> +current heading, the new heading is placed after the body instead  
> of before
> +it.  This command works from anywhere in the entry.
> @kindex M-S-@key{RET}
> @item M-S-@key{RET}
> Insert new TODO entry with same level as current heading.
> -- 
> 1.6.0
>
>
> From 4f7aed562ae93759fb1638378029aeef3cc70e79 Mon Sep 17 00:00:00 2001
> From: Peter Jones <pjones@pmade.com>
> Date: Fri, 17 Oct 2008 18:03:38 -0600
> Subject: [PATCH] Also fix org-insert-todo-heading
>
> ---
> lisp/org.el |   10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 541cf3a..5e4d6a5 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -4684,18 +4684,18 @@ but create the new hedline after the current  
> line."
>   (let ((org-insert-heading-respect-content t))
>     (org-insert-heading t)))
>
> -(defun org-insert-todo-heading-respect-content ()
> -  (interactive)
> +(defun org-insert-todo-heading-respect-content (force-state)
> +  (interactive "P")
>   (let ((org-insert-heading-respect-content t))
> -    (call-interactively 'org-insert-todo-heading)))
> +    (org-insert-todo-heading force-state t)))
>
> -(defun org-insert-todo-heading (arg)
> +(defun org-insert-todo-heading (arg &optional force-heading)
>   "Insert a new heading with the same level and TODO state as  
> current heading.
> If the heading has no TODO state, or if the state is DONE, use the  
> first
> state (TODO by default).  Also with prefix arg, force first state."
>   (interactive "P")
>   (when (not (org-insert-item 'checkbox))
> -    (org-insert-heading)
> +    (org-insert-heading force-heading)
>     (save-excursion
>       (org-back-to-heading)
>       (outline-previous-heading)
> -- 
> 1.6.0
>
>
> -- 
> Peter Jones, http://pmade.com
> pmade inc.  Louisville, CO US
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[-- Attachment #1.2: Type: text/html, Size: 9299 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Fix Subtle Heading Creation Bugs
  2008-10-22  6:02 ` [PATCH] " Carsten Dominik
@ 2008-10-23  0:30   ` Peter Jones
  2008-10-23  5:07     ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Jones @ 2008-10-23  0:30 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:
> I have applied your full patch, thanks.
>
> Please verify the push, I did have a little technical problem when
> applying, so please make sure it worked correctly.

Almost, I must have forgotten this:

diff --git a/lisp/org.el b/lisp/org.el
index ad0f106..5bca9e8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4694,7 +4694,7 @@ but create the new hedline after the current line."
 If the heading has no TODO state, or if the state is DONE, use the first
 state (TODO by default).  Also with prefix arg, force first state."
   (interactive "P")
-  (when (not (org-insert-item 'checkbox))
+  (when (or force-heading (not (org-insert-item 'checkbox)))
     (org-insert-heading force-heading)
     (save-excursion
       (org-back-to-heading)

-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

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

* Re: Re: Fix Subtle Heading Creation Bugs
  2008-10-23  0:30   ` Peter Jones
@ 2008-10-23  5:07     ` Carsten Dominik
  0 siblings, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2008-10-23  5:07 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Oct 23, 2008, at 2:30 AM, Peter Jones wrote:

> Carsten Dominik <dominik@science.uva.nl> writes:
>> I have applied your full patch, thanks.
>>
>> Please verify the push, I did have a little technical problem when
>> applying, so please make sure it worked correctly.
>
> Almost, I must have forgotten this:
>
> diff --git a/lisp/org.el b/lisp/org.el
> index ad0f106..5bca9e8 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -4694,7 +4694,7 @@ but create the new hedline after the current  
> line."
> If the heading has no TODO state, or if the state is DONE, use the  
> first
> state (TODO by default).  Also with prefix arg, force first state."
>   (interactive "P")
> -  (when (not (org-insert-item 'checkbox))
> +  (when (or force-heading (not (org-insert-item 'checkbox)))
>     (org-insert-heading force-heading)
>     (save-excursion
>       (org-back-to-heading)
>
> -- 
> Peter Jones, http://pmade.com
> pmade inc.  Louisville, CO US
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2008-10-23  6:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-18  0:10 [PATCH] Fix Subtle Heading Creation Bugs Peter Jones
2008-10-18  6:01 ` Carsten Dominik
2008-10-18 15:24   ` Peter Jones
2008-10-18 17:59     ` Manish
2008-10-22  6:02 ` [PATCH] " Carsten Dominik
2008-10-23  0:30   ` Peter Jones
2008-10-23  5:07     ` Carsten Dominik

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).