On 08/10/2010 11:41 PM, Nathan Neff wrote:
> Is there a function in org-mode that returns the TODO
> status of the heading that the cursor is currently in?
> 

Yes, try "org-get-todo-state". (Found this using C-h f, typing "org",
then using I-Search in the completion buffer.)
This returns something like this:

#("NEXT" 0 4 (fontified t org-category #("org-dev" 0 7 (fontified t face
org-property-value org-category "projects")) face org-todo))

or nil if there is no TODO state.

This syntax is new to me (elisp noob here), but the elisp reference told
me it's just a string with text properties.

The following code seems to accomplish your goal:

(defun jb/smart-insert-heading ()
  (if (org-get-todo-state)
           (call-interactively 'org-insert-todo-heading)
         (call-interactively 'org-insert-heading)))

HTH, Jan

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to