emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathan Neff <nathan.neff@gmail.com>
To: "Jan Böcker" <jan.boecker@jboecker.de>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Re: Insert TODO or plain heading depending on context
Date: Tue, 10 Aug 2010 17:52:49 -0500	[thread overview]
Message-ID: <AANLkTi=o30LPYM70AHamw3Bpug3bm2R2c=TKoxJ3pVSo@mail.gmail.com> (raw)
In-Reply-To: <4C61CDB7.2040604@jboecker.de>

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


      reply	other threads:[~2010-08-10 23:06 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
2010-08-10 22:52     ` Nathan Neff [this message]

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='AANLkTi=o30LPYM70AHamw3Bpug3bm2R2c=TKoxJ3pVSo@mail.gmail.com' \
    --to=nathan.neff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jan.boecker@jboecker.de \


* 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).