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
next prev parent 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* 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 \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.