浏览代码

Fix headline insertion after inline task

* lisp/org-inlinetask.el (org-inlinetask-min-level): Set customization
type to integer or nil.
* lisp/org.el (org-insert-heading): When after an inline task, do not
use level but go back to headline level before the inline task
Carsten Dominik 15 年之前
父节点
当前提交
e101ec0c8e
共有 2 个文件被更改,包括 16 次插入3 次删除
  1. 3 1
      lisp/org-inlinetask.el
  2. 13 2
      lisp/org.el

+ 3 - 1
lisp/org-inlinetask.el

@@ -90,7 +90,9 @@ or to a number smaller than this one.  In fact, when `org-cycle-max-level' is
 not set, it will be assumed to be one less than the value of smaller than
 not set, it will be assumed to be one less than the value of smaller than
 the value of this variable."
 the value of this variable."
   :group 'org-inlinetask
   :group 'org-inlinetask
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Off" nil)
+	  (integer)))
 
 
 (defcustom org-inlinetask-export t
 (defcustom org-inlinetask-export t
   "Non-nil means export inline tasks.
   "Non-nil means export inline tasks.

+ 13 - 2
lisp/org.el

@@ -6687,8 +6687,9 @@ When INVISIBLE-OK is set, stop at invisible headlines when going back.
 This is important for non-interactive uses of the command."
 This is important for non-interactive uses of the command."
   (interactive "P")
   (interactive "P")
   (if (or (= (buffer-size) 0)
   (if (or (= (buffer-size) 0)
-	  (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok))
-					 (org-on-heading-p))))
+	  (and (not (save-excursion
+		      (and (ignore-errors (org-back-to-heading invisible-ok))
+			   (org-on-heading-p))))
 	       (not (org-in-item-p))))
 	       (not (org-in-item-p))))
       (progn
       (progn
 	(insert "\n* ")
 	(insert "\n* ")
@@ -6699,6 +6700,16 @@ This is important for non-interactive uses of the command."
 		     (condition-case nil
 		     (condition-case nil
 			 (progn
 			 (progn
 			   (org-back-to-heading invisible-ok)
 			   (org-back-to-heading invisible-ok)
+			   (when (and (featurep 'org-inlinetask)
+				      (integerp org-inlinetask-min-level)
+				      (>= (length (match-string 0))
+					  org-inlinetask-min-level))
+			     ;; Find a heading level before the inline task
+			     (while (and (setq level (org-up-heading-safe))
+					 (>= level org-inlinetask-min-level)))
+			     (if (org-on-heading-p)
+				 (org-back-to-heading invisible-ok)
+			       (error "This should not happen")))
 			   (setq empty-line-p (org-previous-line-empty-p))
 			   (setq empty-line-p (org-previous-line-empty-p))
 			   (match-string 0))
 			   (match-string 0))
 		       (error "*"))))
 		       (error "*"))))