emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
@ 2010-09-06 13:56 Joseph Buchignani
  2010-09-06 22:09 ` Łukasz Stelmach
  2010-11-09 20:26 ` Matt Lundin
  0 siblings, 2 replies; 8+ messages in thread
From: Joseph Buchignani @ 2010-09-06 13:56 UTC (permalink / raw)
  To: Emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1141 bytes --]

Hi Org mode,

Summary: I would like habits to automatically be marked as the todo keyword
"HABIT" instead of "TODO" after I mark them "DONE"

Reasons:
I want to keep my habits separate from my tasks. But they display together
on my TODO list. This makes it hard to keep track of what's a habit and
what's not.

I could change a setting so that scheduled tasks are no longer considered
open. But then I lose the ability to see all my habits in a list on the TODO
view.

Also, I like to see habits clearly marked HABIT instead of TODO in my org
outline.

Keeping the keywords separated fits better with my workflow. Normally I only
need to work on habits from within the org agenda, not the todo list. For
example, I start the day by executing scheduled tasks, then priority A
tasks, then priority A habits, etc.

Is there some setting I can change to do this? Right now I am doing it
manually.

Thanks,
JB

-- 
Ignore the following. It is a nonsense sentence that disables Google ads
from displaying next to my emails by triggering sensitive keywords.

I enjoy the massacre of ads. This sentence will slaughter ads without a
messy bloodbath.

[-- Attachment #1.2: Type: text/html, Size: 1281 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-09-06 13:56 Force completed habits to revert to "HABIT" todo keyword instead of "TODO" Joseph Buchignani
@ 2010-09-06 22:09 ` Łukasz Stelmach
  2010-11-09 20:26 ` Matt Lundin
  1 sibling, 0 replies; 8+ messages in thread
From: Łukasz Stelmach @ 2010-09-06 22:09 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Buchignani <joseph.buchignani@gmail.com> writes:

> Summary: I would like habits to automatically be marked as the todo keyword
> "HABIT" instead of "TODO" after I mark them "DONE"
>
> Reasons:
> I want to keep my habits separate from my tasks. But they display together
> on my TODO list. This makes it hard to keep track of what's a habit and
> what's not.

You can exclude from your TODO list all entris with a STYLE propert
equal `habit'.

> I could change a setting so that scheduled tasks are no longer considered
> open. But then I lose the ability to see all my habits in a list on the TODO
> view.
>
> Also, I like to see habits clearly marked HABIT instead of TODO in my org
> outline.

That's a much better reason.

> Keeping the keywords separated fits better with my workflow. Normally I only
> need to work on habits from within the org agenda, not the todo list. For
> example, I start the day by executing scheduled tasks, then priority A
> tasks, then priority A habits, etc.
>
> Is there some setting I can change to do this? Right now I am doing it
> manually.

I'd try putting habits in a separate file with its own set of TODO
kewords defined in a line beginning with `#+SEQ_TODO'. You can also try
defining a different DONE keyword for habits together with HABIT and use
it as a TODO keyword sequence as described here.

<info:org#Multiple sets in one file>
http://orgmode.org/manual/Multiple-sets-in-one-file.html#Multiple-sets-in-one-file

I am sure someone with more moxie and bigger mojo than me (at least for
now i.e. 00:08 CEST) could come up with a function you could add to
org-after-todo-state-change-hook that does exactly what you want.

-- 
Miłego dnia,
Łukasz Stelmach

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

* Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-09-06 13:56 Force completed habits to revert to "HABIT" todo keyword instead of "TODO" Joseph Buchignani
  2010-09-06 22:09 ` Łukasz Stelmach
@ 2010-11-09 20:26 ` Matt Lundin
  2010-11-09 20:37   ` Joseph Buchignani
  1 sibling, 1 reply; 8+ messages in thread
From: Matt Lundin @ 2010-11-09 20:26 UTC (permalink / raw)
  To: Joseph Buchignani; +Cc: Emacs-orgmode

Hi Joseph,

Joseph Buchignani <joseph.buchignani@gmail.com> writes:

> Summary: I would like habits to automatically be marked as the todo
> keyword "HABIT" instead of "TODO" after I mark them "DONE"
>
> Reasons:
> I want to keep my habits separate from my tasks. But they display
> together on my TODO list. This makes it hard to keep track of what's a
> habit and what's not.
>
> I could change a setting so that scheduled tasks are no longer
> considered open. But then I lose the ability to see all my habits in a
> list on the TODO view.
>
> Also, I like to see habits clearly marked HABIT instead of TODO in my
> org outline.
>
> Keeping the keywords separated fits better with my workflow. Normally I
> only need to work on habits from within the org agenda, not the todo
> list. For example, I start the day by executing scheduled tasks, then
> priority A tasks, then priority A habits, etc.
>
> Is there some setting I can change to do this? Right now I am doing it
> manually.

Apologies for the late reply, but one simple way to make sure repeating
habits return to a HABIT state is to add a REPEAT_TO_STATE property to
each of your habits. (Of course, HABIT needs to be defined in your
org-todo-keywords.)

E.g.,

--8<---------------cut here---------------start------------->8---
* HABIT Run
  SCHEDULED: <2010-11-09 Tue .+1d/2d>
  :PROPERTIES:
  :STYLE:    habit
  :REPEAT_TO_STATE: HABIT
  :END:
--8<---------------cut here---------------end--------------->8---

If you want to do this quickly for all existing habits you could
evaluate the following:

--8<---------------cut here---------------start------------->8---
(org-map-entries '(org-set-property "REPEAT_TO_STATE" "HABIT") 
		 "+STYLE=\"HABIT\"" 'agenda)
--8<---------------cut here---------------end--------------->8---

Best,
Matt

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

* Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-11-09 20:26 ` Matt Lundin
@ 2010-11-09 20:37   ` Joseph Buchignani
  2010-11-09 20:58     ` David Maus
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph Buchignani @ 2010-11-09 20:37 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Emacs-orgmode

Hi Matt,

Thanks for your very helpful reply.

I know this is a noob question, so please forgive me for taxing your patience...

How do I evaluate the statement you supplied for just one file? E.g. I
want to evaluate your statement for notes.org, what do I do?

Thanks,
JB

On Wed, Nov 10, 2010 at 4:26 AM, Matt Lundin <mdl@imapmail.org> wrote:
> Hi Joseph,
>
> Joseph Buchignani <joseph.buchignani@gmail.com> writes:
>
>> Summary: I would like habits to automatically be marked as the todo
>> keyword "HABIT" instead of "TODO" after I mark them "DONE"
>>
>> Reasons:
>> I want to keep my habits separate from my tasks. But they display
>> together on my TODO list. This makes it hard to keep track of what's a
>> habit and what's not.
>>
>> I could change a setting so that scheduled tasks are no longer
>> considered open. But then I lose the ability to see all my habits in a
>> list on the TODO view.
>>
>> Also, I like to see habits clearly marked HABIT instead of TODO in my
>> org outline.
>>
>> Keeping the keywords separated fits better with my workflow. Normally I
>> only need to work on habits from within the org agenda, not the todo
>> list. For example, I start the day by executing scheduled tasks, then
>> priority A tasks, then priority A habits, etc.
>>
>> Is there some setting I can change to do this? Right now I am doing it
>> manually.
>
> Apologies for the late reply, but one simple way to make sure repeating
> habits return to a HABIT state is to add a REPEAT_TO_STATE property to
> each of your habits. (Of course, HABIT needs to be defined in your
> org-todo-keywords.)
>
> E.g.,
>
> --8<---------------cut here---------------start------------->8---
> * HABIT Run
>  SCHEDULED: <2010-11-09 Tue .+1d/2d>
>  :PROPERTIES:
>  :STYLE:    habit
>  :REPEAT_TO_STATE: HABIT
>  :END:
> --8<---------------cut here---------------end--------------->8---
>
> If you want to do this quickly for all existing habits you could
> evaluate the following:
>
> --8<---------------cut here---------------start------------->8---
> (org-map-entries '(org-set-property "REPEAT_TO_STATE" "HABIT")
>                 "+STYLE=\"HABIT\"" 'agenda)
> --8<---------------cut here---------------end--------------->8---
>
> Best,
> Matt
>



-- 
Ignore the following. It is a nonsense sentence that disables Google
ads from displaying next to my emails by triggering sensitive
keywords.

I enjoy the massacre of ads. This sentence will slaughter ads without
a messy bloodbath.

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

* Re: Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-11-09 20:37   ` Joseph Buchignani
@ 2010-11-09 20:58     ` David Maus
  2010-11-09 21:09       ` David Maus
  0 siblings, 1 reply; 8+ messages in thread
From: David Maus @ 2010-11-09 20:58 UTC (permalink / raw)
  To: Joseph Buchignani; +Cc: Matt Lundin, Emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 949 bytes --]

At Wed, 10 Nov 2010 04:37:43 +0800,
Joseph Buchignani wrote:
> 
> Hi Matt,
> 
> Thanks for your very helpful reply.
> 
> I know this is a noob question, so please forgive me for taxing your patience...
> 
> How do I evaluate the statement you supplied for just one file? E.g. I
> want to evaluate your statement for notes.org, what do I do?

Örm, well: The original function would not reset the todo state
change, but set the REPEAT_TO_STATE property (i.e.: org-set-property).

To use the (right) org-map-entries function interactively, just define
a interactive function:

(defun hb:set-habit-keyword ()
  "*Set keyword of habits in current buffer."
  (interactive)
  (org-map-entries
   '(org-todo (org-entry-get nil "REPEAT_TO_STATE"))
   "STYLE=\"HABIT\""))

And call it with M-x hb:set-habit-keyword.

HTH,
  -- David

-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-11-09 20:58     ` David Maus
@ 2010-11-09 21:09       ` David Maus
  2010-11-09 21:17         ` Joseph Buchignani
  0 siblings, 1 reply; 8+ messages in thread
From: David Maus @ 2010-11-09 21:09 UTC (permalink / raw)
  To: David Maus; +Cc: Matt Lundin, Emacs-orgmode, Joseph Buchignani

Sorry, I couldn't help myself:

(defun hb:set-habit-keyword-2 ()
  "*Reset keyword of done habit."
  (let ((reset-to (org-entry-get nil "REPEAT_TO_STATE")))
    (if (and reset-to (string= state "DONE"))
	(org-todo reset-to))))
(add-hook 'org-after-todo-state-change-hook 'hb:set-habit-keyword-2)

Every time a todo turns into DONE, this function is run and sets the
keyword to whatever is stored in REPEAT_TO_STATE.

Best,
  -- David
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

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

* Re: Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-11-09 21:09       ` David Maus
@ 2010-11-09 21:17         ` Joseph Buchignani
  2010-11-09 21:27           ` David Maus
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph Buchignani @ 2010-11-09 21:17 UTC (permalink / raw)
  To: David Maus; +Cc: Matt Lundin, Emacs-orgmode

David, I understand what your second function does, but I'm confused
about what the first one does.

Does the first function set all habits to have a "return to state" property?

Or does it cause all habits to revert to the "return to state" defined
keyword, if it is defined?

I was asking how to set "return to state" for all the habits contained
in a single file. Since I have a lot of habits and none of them
currently have a "return to state" property.

Thanks,
JB

On Wed, Nov 10, 2010 at 5:09 AM, David Maus <dmaus@ictsoc.de> wrote:
> Sorry, I couldn't help myself:
>
> (defun hb:set-habit-keyword-2 ()
>  "*Reset keyword of done habit."
>  (let ((reset-to (org-entry-get nil "REPEAT_TO_STATE")))
>    (if (and reset-to (string= state "DONE"))
>        (org-todo reset-to))))
> (add-hook 'org-after-todo-state-change-hook 'hb:set-habit-keyword-2)
>
> Every time a todo turns into DONE, this function is run and sets the
> keyword to whatever is stored in REPEAT_TO_STATE.
>
> Best,
>  -- David
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de
>



-- 
Ignore the following. It is a nonsense sentence that disables Google
ads from displaying next to my emails by triggering sensitive
keywords.

I enjoy the massacre of ads. This sentence will slaughter ads without
a messy bloodbath.

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

* Re: Re: Force completed habits to revert to "HABIT" todo keyword instead of "TODO"
  2010-11-09 21:17         ` Joseph Buchignani
@ 2010-11-09 21:27           ` David Maus
  0 siblings, 0 replies; 8+ messages in thread
From: David Maus @ 2010-11-09 21:27 UTC (permalink / raw)
  To: Joseph Buchignani; +Cc: David Maus, Matt Lundin, Emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 614 bytes --]

At Wed, 10 Nov 2010 05:17:16 +0800,
Joseph Buchignani wrote:
>
> David, I understand what your second function does, but I'm confused
> about what the first one does.
>
> Does the first function set all habits to have a "return to state" property?

Argh, no.  I misread the original question.  If you want this property
present in all headlines with the HABIT property, use the
org-map-entries function supplied by Matt and wrap it in the
(interactive) function.

Damn, first read carefully, than answer :|

Best,

 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-11-09 21:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-06 13:56 Force completed habits to revert to "HABIT" todo keyword instead of "TODO" Joseph Buchignani
2010-09-06 22:09 ` Łukasz Stelmach
2010-11-09 20:26 ` Matt Lundin
2010-11-09 20:37   ` Joseph Buchignani
2010-11-09 20:58     ` David Maus
2010-11-09 21:09       ` David Maus
2010-11-09 21:17         ` Joseph Buchignani
2010-11-09 21:27           ` David Maus

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