emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* use todo-keyword to assign category
@ 2009-10-19  0:40 Eraldo Helal
  2009-10-19  2:10 ` James TD Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Eraldo Helal @ 2009-10-19  0:40 UTC (permalink / raw)
  To: Org-Mode

ISSUE:

I have a keyword "CATEGORY" which I use on headlines to make me aware
that they define a category for everything below them.

example:
file: school.org
* CATEGORY English
#+CATEGORY: English
** PROJECT presentation "org-mode"
*** TODO call Tom: beamer
*** TODO search pictures
** TODO homework p. 42
* CATEGORY Math
#+CATEGORY: Math
** TODO homework sheet Nr. 4
...

Is it possible to let emacs know that every headline with the
"CATEGORY" todo-keyword should be used as a category?
> If not... I think it would be a great feature to add!

ADVANTAGES:

this would bring the following advantages:
- I would not have to add "#+CATEGORY:" nor type the same words as the
headline after it
- I could define a category by using my todo-keyword menu. with
shortcuts and fast selection!
- I could use the agenda view to get a list of all categories defined
in that way... and be able to filter them!

WORKAROUND:

Until then I have to add "#+CATEGORY: <repeat headline words>" on
every such headline and be aware that changing the headline does not
change the category wording.

> PROBLEM: more work, redundant

or

use the "CATEGORY" todo-keyword without "#+CATEGORY"
> this however would result in the following Agenda buffer for our example:
school: TODO call Tom: beamer
school: TODO search pictures
school: TODO homework p. 42
school: TODO homework sheet Nr. 4

> PROBLEM: agenda buffer unclear (school is not precise enough)


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

Greetings from Austria,
Eraldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: use todo-keyword to assign category
  2009-10-19  0:40 use todo-keyword to assign category Eraldo Helal
@ 2009-10-19  2:10 ` James TD Smith
  2009-10-19 23:55   ` Eraldo Helal
  0 siblings, 1 reply; 5+ messages in thread
From: James TD Smith @ 2009-10-19  2:10 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: use todo-keyword to assign category
  2009-10-19  2:10 ` James TD Smith
@ 2009-10-19 23:55   ` Eraldo Helal
  2009-10-20  1:09     ` James TD Smith
  0 siblings, 1 reply; 5+ messages in thread
From: Eraldo Helal @ 2009-10-19 23:55 UTC (permalink / raw)
  To: James TD Smith; +Cc: Org-Mode

Great James!

Thank you very much for this function!
That will update the prop if I change the headline wording, right?
Nice to know that others use it in a similar way!
Maybe it would still be a nice idea to have the possibility of having
the headline itself be the category.
Until then I will gratefully use your code.

Eraldo (happy about the good news)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: use todo-keyword to assign category
  2009-10-19 23:55   ` Eraldo Helal
@ 2009-10-20  1:09     ` James TD Smith
  2009-10-20  1:49       ` Eraldo Helal
  0 siblings, 1 reply; 5+ messages in thread
From: James TD Smith @ 2009-10-20  1:09 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode

On 2009-10-20 01:55:38(+0200), Eraldo Helal wrote:
> Great James!
>
> Thank you very much for this function!
> That will update the prop if I change the headline wording, right?

No, it only updates the property when the todo keyword is set to CATEGORY. If
you want to change the category you would need to either change the property
directly (with C-c C-x p CATEGORY RET) or set the todo keyword to CATEGORY
again after editing the headline.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: use todo-keyword to assign category
  2009-10-20  1:09     ` James TD Smith
@ 2009-10-20  1:49       ` Eraldo Helal
  0 siblings, 0 replies; 5+ messages in thread
From: Eraldo Helal @ 2009-10-20  1:49 UTC (permalink / raw)
  To: James TD Smith; +Cc: Org-Mode

sounds good...
thanks again

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-20  1:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-19  0:40 use todo-keyword to assign category Eraldo Helal
2009-10-19  2:10 ` James TD Smith
2009-10-19 23:55   ` Eraldo Helal
2009-10-20  1:09     ` James TD Smith
2009-10-20  1:49       ` Eraldo Helal

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