diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-04-20 18:31:03 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-04-20 18:31:03 +0200 |
commit | 5a62721822ccf5675e1d8d52ae0f10c3f790ed2f (patch) | |
tree | e22930cc6d3c0cb5f2edab74f6636a7cd5258363 | |
parent | 1ac063248f1990e02e3b30cafd4c32c2193f9549 (diff) | |
download | org-mode-5a62721822ccf5675e1d8d52ae0f10c3f790ed2f.tar.gz |
Make inline task insertion deal with `org-odd-levels-only'
Also make it possible to define a default state for an inline task.
Patch by Sebastian Rose.
-rwxr-xr-x | lisp/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/org-inlinetask.el | 26 |
2 files changed, 25 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a552c9f..5890329 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2010-04-20 Carsten Dominik <carsten.dominik@gmail.com> + * org-inlinetask.el (org-inlinetask-defaut-state): New option. + (org-inlinetask-insert-task): Use `org-inlinetask-defaut-state'. + Obey `org-odd-levels-only'. + * org-compat.el (org-find-overlays): Use overlays-in/at. * org.el (org-remove-empty-overlays-at) diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index aac338b..9479aea 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -105,12 +105,28 @@ When nil, they will not be exported." (defvar org-complex-heading-regexp) (defvar org-property-end-re) -(defun org-inlinetask-insert-task () - "Insert an inline task." - (interactive) +(defcustom org-inlinetask-defaut-state nil + "Non-nil means make inline tasks have a TODO keyword initially. +This should be the state `org-inlinetask-insert-task' should use by +default, or nil of no state should be assigned." + :group 'org-inlinetask + :type (choice + (const :tag "No state" nil) + (string :tag "Specific state"))) + +(defun org-inlinetask-insert-task (&optional no-state) + "Insert an inline task. +If prefix arg NO-STATE is set, irgnore `org-inlinetask-defaut-state'." + (interactive "P") (or (bolp) (newline)) - (insert (make-string org-inlinetask-min-level ?*) " \n" - (make-string org-inlinetask-min-level ?*) " END\n") + (let ((indent org-inlinetask-min-level)) + (if org-odd-levels-only + (setq indent (- (* 2 indent) 1))) + (insert (make-string indent ?*) + (if (or no-state (not org-inlinetask-defaut-state)) + " \n" + (concat " " org-inlinetask-defaut-state " \n")) + (make-string indent ?*) " END\n")) (end-of-line -1)) (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task) |