summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-10-14 10:29:56 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-10-14 10:29:56 +0200
commite101ec0c8e6ac6e8c08bea0324d039c639012250 (patch)
tree2e86949d0a0579b020921779db81feb64b48b00c
parentf5152e03a12a3256bf6c7ecaffd5b421a1fa606a (diff)
downloadorg-mode-e101ec0c8e6ac6e8c08bea0324d039c639012250.tar.gz
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
-rw-r--r--lisp/org-inlinetask.el4
-rw-r--r--lisp/org.el15
2 files changed, 16 insertions, 3 deletions
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index e18dce8..29b1544 100644
--- a/lisp/org-inlinetask.el
+++ b/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.
diff --git a/lisp/org.el b/lisp/org.el
index c49d171..014cbe4 100644
--- a/lisp/org.el
+++ b/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 "*"))))