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).
This commit is contained in:
Bastien Guerry 2014-03-12 17:51:18 +01:00
parent ccd1d1a198
commit 250abf061b
1 changed files with 8 additions and 4 deletions

View File

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