Function: org-inlinetask-insert-task
org-inlinetask-insert-task is an interactive and byte-compiled
function defined in org-inlinetask.el.gz.
Signature
(org-inlinetask-insert-task &optional NO-STATE)
Documentation
Insert an inline task.
If prefix arg NO-STATE is set, ignore org-inlinetask-default-state.
If there is a region wrap it inside the inline task.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-inlinetask.el.gz
(defun org-inlinetask-insert-task (&optional no-state)
"Insert an inline task.
If prefix arg NO-STATE is set, ignore `org-inlinetask-default-state'.
If there is a region wrap it inside the inline task."
(interactive "P")
;; Error when inside an inline task, except if point was at its very
;; beginning, in which case the new inline task will be inserted
;; before this one.
(when (and (org-inlinetask-in-task-p)
(not (and (org-inlinetask-at-task-p) (bolp))))
(user-error "Cannot nest inline tasks"))
(or (bolp) (newline))
(let* ((indent (if org-odd-levels-only
(1- (* 2 org-inlinetask-min-level))
org-inlinetask-min-level))
(indent-string (concat (make-string indent ?*) " "))
(rbeg (if (org-region-active-p) (region-beginning) (point)))
(rend (if (org-region-active-p) (region-end) (point))))
(goto-char rend)
(insert "\n" indent-string "END\n")
(goto-char rbeg)
(unless (bolp) (insert "\n"))
(insert indent-string
(if (or no-state (not org-inlinetask-default-state))
""
(concat org-inlinetask-default-state " "))
(if (= rend rbeg) "" "\n"))
(unless (= rend rbeg) (end-of-line 0))))