From 250abf061ba81c1d010c19d5f54506f10a37c1cb Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 12 Mar 2014 17:51:18 +0100 Subject: [PATCH] Bugfixes wrt inserting headings. * org.el (org-insert-heading): Fix regression: with two universal prefixes, insert heading at the end of the subtree. (org-insert-todo-heading): Bugfix: only enforce the first TODO state when arg is '(4). --- lisp/org.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 0e36f60d6..720600da5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7542,7 +7542,7 @@ This is important for non-interactive uses of the command." (let ((itemp (org-in-item-p)) (may-split (org-get-alist-option org-M-RET-may-split-line 'headline)) (respect-content (or org-insert-heading-respect-content - (equal arg '(16)))) + (equal arg '(4)))) (initial-content "") (adjust-empty-lines t)) @@ -7565,6 +7565,10 @@ This is important for non-interactive uses of the command." (org-insert-item)) (t + ;; Maybe move at the end of the subtree + (when (equal arg '(16)) + (org-up-heading-safe) + (org-end-of-subtree t)) ;; Insert a heading (save-restriction (widen) @@ -7759,8 +7763,8 @@ This is a list with the following elements: (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 one prefix arg, force first state. With two -prefix args, force inserting at the end of the parent subtree." +state (TODO by default). Also with one prefix arg, force first state. With +two prefix args, force inserting at the end of the parent subtree." (interactive "P") (when (or force-heading (not (org-insert-item 'checkbox))) (org-insert-heading (or (and (equal arg '(16)) '(16)) @@ -7771,7 +7775,7 @@ prefix args, force inserting at the end of the parent subtree." (looking-at org-todo-line-regexp)) (let* ((new-mark-x - (if (or arg + (if (or (equal arg '(4)) (not (match-beginning 2)) (member (match-string 2) org-done-keywords)) (car org-todo-keywords-1)