فهرست منبع

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 14 سال پیش
والد
کامیت
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
 the value of this variable."
   :group 'org-inlinetask
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Off" nil)
+	  (integer)))
 
 (defcustom org-inlinetask-export t
   "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."
   (interactive "P")
   (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))))
       (progn
 	(insert "\n* ")
@@ -6699,6 +6700,16 @@ This is important for non-interactive uses of the command."
 		     (condition-case nil
 			 (progn
 			   (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))
 			   (match-string 0))
 		       (error "*"))))