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: Jan Böcker
Subject: Re: [Orgmode] Re: Insert TODO or plain heading depending on context
Date: Wed, 11 Aug 2010 00:07:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6

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



reply via email to

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