On Tue, Aug 10, 2010 at 5:07 PM, Jan Böcker <jan.boec...@jboecker.de> wrote:
> 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
>

Thanks Jan, this helped a lot!  I appreciate the C-h f reminder -- I
have searched
through org.el and didn't come up with the right search terms.  This
should help me in
the future.

BTW, your function works perfectly!

Thanks,
--Nate

_______________________________________________
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