emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Insert TODO or plain heading depending on context


From: Nathan Neff
Subject: Re: [Orgmode] Re: Insert TODO or plain heading depending on context
Date: Tue, 10 Aug 2010 17:52:49 -0500

On Tue, Aug 10, 2010 at 5:07 PM, Jan Böcker <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]