emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Jan Böcker" <jan.boecker@jboecker.de>
To: Nathan Neff <nathan.neff@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Re: Insert TODO or plain heading depending on context
Date: Wed, 11 Aug 2010 00:07:51 +0200	[thread overview]
Message-ID: <4C61CDB7.2040604@jboecker.de> (raw)
In-Reply-To: <AANLkTinsToBeoX6RzUTpLSbL-ww+nPvrKnG3NtdNuS2Q@mail.gmail.com>

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	other threads:[~2010-08-10 22:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 15:43 Insert TODO or plain heading depending on context Nathan Neff
2010-08-10 21:41 ` Nathan Neff
2010-08-10 22:07   ` Jan Böcker [this message]
2010-08-10 22:52     ` Nathan Neff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C61CDB7.2040604@jboecker.de \
    --to=jan.boecker@jboecker.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=nathan.neff@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).