emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: James TD Smith <ahktenzero@mohorovi.cc>
To: Eraldo Helal <eraldo@eraldo.at>
Cc: Org-Mode <emacs-orgmode@gnu.org>
Subject: Re: use todo-keyword to assign category
Date: Mon, 19 Oct 2009 03:10:15 +0100	[thread overview]
Message-ID: <20091019021015.GJ72276@yog-sothoth.mohorovi.cc> (raw)
In-Reply-To: <938fae2d0910181740o1aa9b373x951c852a321c7fed@mail.gmail.com>

Hi Eraldo,

On 2009-10-19 02:40:19(+0200), Eraldo Helal wrote:
> I have a keyword "CATEGORY" which I use on headlines to make me aware
> that they define a category for everything below them.

[snip]

> Is it possible to let emacs know that every headline with the
> "CATEGORY" todo-keyword should be used as a category?

[snip]

> Any ideas on how to get there or feedback on the idea?

I tend to set categories on any task with lots of subtasks for the same reason.
I do this by setting the CATEGORY property on the top level task, usually by
hand as I want to keep the category names short. I think the inline #+CATEGORY
lines are deprecated in favour of using properties.

Add the following to your .emacs;

--8<---------------cut here---------------start------------->8---
(add-hook 'org-after-todo-state-change-hook
  (lambda ()
      (if (string= state "CATEGORY")
      (save-excursion
        (org-back-to-heading)
	  (org-set-property "CATEGORY"
	      (nth 4 (org-heading-components)))))))
--8<---------------cut here---------------end--------------->8---

When you set the todo state of an entry to CATEGORY, it will copy the headline
text to the CATEGORY property.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

  reply	other threads:[~2009-10-19  2:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19  0:40 use todo-keyword to assign category Eraldo Helal
2009-10-19  2:10 ` James TD Smith [this message]
2009-10-19 23:55   ` Eraldo Helal
2009-10-20  1:09     ` James TD Smith
2009-10-20  1:49       ` Eraldo Helal

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

  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=20091019021015.GJ72276@yog-sothoth.mohorovi.cc \
    --to=ahktenzero@mohorovi.cc \
    --cc=emacs-orgmode@gnu.org \
    --cc=eraldo@eraldo.at \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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