[Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-11-09 Thread Matt Lundin
Hi Joseph,

Joseph Buchignani joseph.buchign...@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

___
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


[Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-11-09 Thread Joseph Buchignani
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 m...@imapmail.org wrote:
 Hi Joseph,

 Joseph Buchignani joseph.buchign...@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.

___
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


Re: [Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-11-09 Thread David Maus
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 dmj...@jabber.org
Email. dm...@ictsoc.de


pgpXYPTSShd5H.pgp
Description: PGP signature
___
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


Re: [Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-11-09 Thread David Maus
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 dmj...@jabber.org
Email. dm...@ictsoc.de

___
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


Re: [Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-11-09 Thread Joseph Buchignani
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 dm...@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 dmj...@jabber.org
 Email. dm...@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.

___
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


Re: [Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-11-09 Thread David Maus
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 dmj...@jabber.org
Email. dm...@ictsoc.de


pgpt1WYMZKvqe.pgp
Description: PGP signature
___
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


[Orgmode] Re: Force completed habits to revert to HABIT todo keyword instead of TODO

2010-09-06 Thread Łukasz Stelmach
Joseph Buchignani joseph.buchign...@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


___
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