浏览代码

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).
Bastien Guerry 11 年之前
父节点
当前提交
250abf061b
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      lisp/org.el

+ 8 - 4
lisp/org.el

@@ -7542,7 +7542,7 @@ This is important for non-interactive uses of the command."
   (let ((itemp (org-in-item-p))
   (let ((itemp (org-in-item-p))
 	(may-split (org-get-alist-option org-M-RET-may-split-line 'headline))
 	(may-split (org-get-alist-option org-M-RET-may-split-line 'headline))
 	(respect-content (or org-insert-heading-respect-content
 	(respect-content (or org-insert-heading-respect-content
-			     (equal arg '(16))))
+			     (equal arg '(4))))
 	(initial-content "")
 	(initial-content "")
 	(adjust-empty-lines t))
 	(adjust-empty-lines t))
 
 
@@ -7565,6 +7565,10 @@ This is important for non-interactive uses of the command."
       (org-insert-item))
       (org-insert-item))
 
 
      (t
      (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
       ;; Insert a heading
       (save-restriction
       (save-restriction
 	(widen)
 	(widen)
@@ -7759,8 +7763,8 @@ This is a list with the following elements:
 (defun org-insert-todo-heading (arg &optional force-heading)
 (defun org-insert-todo-heading (arg &optional force-heading)
   "Insert a new heading with the same level and TODO state as current 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
 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")
   (interactive "P")
   (when (or force-heading (not (org-insert-item 'checkbox)))
   (when (or force-heading (not (org-insert-item 'checkbox)))
     (org-insert-heading (or (and (equal arg '(16)) '(16))
     (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))
       (looking-at org-todo-line-regexp))
     (let*
     (let*
         ((new-mark-x
         ((new-mark-x
-	  (if (or arg
+	  (if (or (equal arg '(4))
 		  (not (match-beginning 2))
 		  (not (match-beginning 2))
 		  (member (match-string 2) org-done-keywords))
 		  (member (match-string 2) org-done-keywords))
  	      (car org-todo-keywords-1)
  	      (car org-todo-keywords-1)