* "clearing" the state of an org-mode subtree
@ 2009-10-09 21:28 Robert Goldman
2009-10-09 23:43 ` Andrew Stribblehill
0 siblings, 1 reply; 12+ messages in thread
From: Robert Goldman @ 2009-10-09 21:28 UTC (permalink / raw
To: Org Mode
I'm at about my one year anniversary using Org-mode, and I have a bit of
an odd question. Last year, I made a subtree that was a project for
getting ready for winter (I live in Minnesota, which has harsh winters).
I worked my way through that list, and now I'd like to do the whole
thing over again.
So I'd like to copy the subtree (this I believe I can easily do), and
then clear it. That is, I'd like to reset all the TODOs from DONE to
TODO, and clear all the check boxes.
This seems like a really odd thing to do, so there probably isn't
automation for it, but before I go groveling over it by hand, I thought
I'd ask.
thanks!
R
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-09 21:28 "clearing" the state of an org-mode subtree Robert Goldman
@ 2009-10-09 23:43 ` Andrew Stribblehill
2009-10-10 17:23 ` Darlan Cavalcante Moreira
2009-10-10 17:47 ` Robert Goldman
0 siblings, 2 replies; 12+ messages in thread
From: Andrew Stribblehill @ 2009-10-09 23:43 UTC (permalink / raw
To: Robert Goldman; +Cc: Org Mode
org-mode files are plain text. M-% to do a replacement: once you've
entered your search term and its replacement, hit ! to replace all
without question.
2009/10/9 Robert Goldman <rpgoldman@sift.info>:
> I'm at about my one year anniversary using Org-mode, and I have a bit of
> an odd question. Last year, I made a subtree that was a project for
> getting ready for winter (I live in Minnesota, which has harsh winters).
>
> I worked my way through that list, and now I'd like to do the whole
> thing over again.
>
> So I'd like to copy the subtree (this I believe I can easily do), and
> then clear it. That is, I'd like to reset all the TODOs from DONE to
> TODO, and clear all the check boxes.
>
> This seems like a really odd thing to do, so there probably isn't
> automation for it, but before I go groveling over it by hand, I thought
> I'd ask.
>
> thanks!
> R
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-09 23:43 ` Andrew Stribblehill
@ 2009-10-10 17:23 ` Darlan Cavalcante Moreira
2009-10-10 17:47 ` Robert Goldman
1 sibling, 0 replies; 12+ messages in thread
From: Darlan Cavalcante Moreira @ 2009-10-10 17:23 UTC (permalink / raw
To: Andrew Stribblehill; +Cc: Org Mode, Robert Goldman
It will be even easier if you narrow to the subtree before making the
replacements with org-narrow-to-subtree (C-x n s) so that you don't risk
changing anythong else. After you have done, run the command widen (C-x n w) to
show the whole file again.
Darlan
At Sat, 10 Oct 2009 00:43:12 +0100,
Andrew Stribblehill <ads@wompom.org> wrote:
>
> org-mode files are plain text. M-% to do a replacement: once you've
> entered your search term and its replacement, hit ! to replace all
> without question.
>
> 2009/10/9 Robert Goldman <rpgoldman@sift.info>:
> > I'm at about my one year anniversary using Org-mode, and I have a bit of
> > an odd question. Last year, I made a subtree that was a project for
> > getting ready for winter (I live in Minnesota, which has harsh winters).
> >
> > I worked my way through that list, and now I'd like to do the whole
> > thing over again.
> >
> > So I'd like to copy the subtree (this I believe I can easily do), and
> > then clear it. That is, I'd like to reset all the TODOs from DONE to
> > TODO, and clear all the check boxes.
> >
> > This seems like a really odd thing to do, so there probably isn't
> > automation for it, but before I go groveling over it by hand, I thought
> > I'd ask.
> >
> > thanks!
> > R
> >
> >
> > _______________________________________________
> > Emacs-orgmode mailing list
> > Remember: use `Reply All' to send replies to the list.
> > Emacs-orgmode@gnu.org
> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> >
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-09 23:43 ` Andrew Stribblehill
2009-10-10 17:23 ` Darlan Cavalcante Moreira
@ 2009-10-10 17:47 ` Robert Goldman
2009-10-11 9:47 ` Paul Mead
2009-10-11 15:11 ` Gregory J. Grubbs
1 sibling, 2 replies; 12+ messages in thread
From: Robert Goldman @ 2009-10-10 17:47 UTC (permalink / raw
To: Andrew Stribblehill; +Cc: Org Mode
Andrew Stribblehill wrote:
> org-mode files are plain text. M-% to do a replacement: once you've
> entered your search term and its replacement, hit ! to replace all
> without question.
Yes, one can do this, but note that it's not entirely a no-brainer. You
need to:
1. clear all the check boxes and then recompute all checkbox counts in
the region. [this isn't a simple tag replacement]
2. replace all non-TODO keywords with TODO. This is a replacement, but
not a simple one to do with M-%
3. Wipe out all of the notes that were added with state changes.
Again, this can be done with a replacement command, but it's not a
trivial one.
This is one of those cases where automating a task will not pay back the
investment (at least not to me, individually), so I think I'd better
just do it by hand.
Thanks, everyone,
r
>
> 2009/10/9 Robert Goldman <rpgoldman@sift.info>:
>> I'm at about my one year anniversary using Org-mode, and I have a bit of
>> an odd question. Last year, I made a subtree that was a project for
>> getting ready for winter (I live in Minnesota, which has harsh winters).
>>
>> I worked my way through that list, and now I'd like to do the whole
>> thing over again.
>>
>> So I'd like to copy the subtree (this I believe I can easily do), and
>> then clear it. That is, I'd like to reset all the TODOs from DONE to
>> TODO, and clear all the check boxes.
>>
>> This seems like a really odd thing to do, so there probably isn't
>> automation for it, but before I go groveling over it by hand, I thought
>> I'd ask.
>>
>> thanks!
>> R
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: 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] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-10 17:47 ` Robert Goldman
@ 2009-10-11 9:47 ` Paul Mead
2009-10-11 12:36 ` Bernt Hansen
2009-10-11 15:11 ` Gregory J. Grubbs
1 sibling, 1 reply; 12+ messages in thread
From: Paul Mead @ 2009-10-11 9:47 UTC (permalink / raw
To: emacs-orgmode
Robert Goldman <rpgoldman@sift.info> writes:
> Andrew Stribblehill wrote:
>> org-mode files are plain text. M-% to do a replacement: once you've
>> entered your search term and its replacement, hit ! to replace all
>> without question.
>
> Yes, one can do this, but note that it's not entirely a no-brainer. You
> need to:
>
> 1. clear all the check boxes and then recompute all checkbox counts in
> the region. [this isn't a simple tag replacement]
>
> 2. replace all non-TODO keywords with TODO. This is a replacement, but
> not a simple one to do with M-%
>
> 3. Wipe out all of the notes that were added with state changes.
> Again, this can be done with a replacement command, but it's not a
> trivial one.
>
> This is one of those cases where automating a task will not pay back the
> investment (at least not to me, individually), so I think I'd better
> just do it by hand.
>
> Thanks, everyone,
Have you thought about using yasnippet? I have a repeating set of TODOs
in a particular order that I have to do every month. Rather than reusing
the old structure, I just insert it again from a snippet. That way I
also have all my notes from last month too.
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-11 9:47 ` Paul Mead
@ 2009-10-11 12:36 ` Bernt Hansen
2009-10-11 16:10 ` Robert P. Goldman
0 siblings, 1 reply; 12+ messages in thread
From: Bernt Hansen @ 2009-10-11 12:36 UTC (permalink / raw
To: Paul Mead; +Cc: emacs-orgmode
Paul Mead <paul.d.mead@gmail.com> writes:
> Robert Goldman <rpgoldman@sift.info> writes:
>
>> Andrew Stribblehill wrote:
>>> org-mode files are plain text. M-% to do a replacement: once you've
>>> entered your search term and its replacement, hit ! to replace all
>>> without question.
>>
>> Yes, one can do this, but note that it's not entirely a no-brainer. You
>> need to:
>>
>> 1. clear all the check boxes and then recompute all checkbox counts in
>> the region. [this isn't a simple tag replacement]
>>
>> 2. replace all non-TODO keywords with TODO. This is a replacement, but
>> not a simple one to do with M-%
>>
>> 3. Wipe out all of the notes that were added with state changes.
>> Again, this can be done with a replacement command, but it's not a
>> trivial one.
>>
>> This is one of those cases where automating a task will not pay back the
>> investment (at least not to me, individually), so I think I'd better
>> just do it by hand.
>>
>> Thanks, everyone,
>
> Have you thought about using yasnippet? I have a repeating set of TODOs
> in a particular order that I have to do every month. Rather than reusing
> the old structure, I just insert it again from a snippet. That way I
> also have all my notes from last month too.
Or copy the subtree _before_ you fill it in with details. Make a
repeating task that is just to copy the subtree at the appropriate time
so the subtree is available for the repeat after this one, and then
proceed to use one of the copies for the current task iteration.
HTH,
Bernt
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-10 17:47 ` Robert Goldman
2009-10-11 9:47 ` Paul Mead
@ 2009-10-11 15:11 ` Gregory J. Grubbs
1 sibling, 0 replies; 12+ messages in thread
From: Gregory J. Grubbs @ 2009-10-11 15:11 UTC (permalink / raw
To: emacs-orgmode
Robert Goldman <rpgoldman@sift.info> writes:
> This is one of those cases where automating a task will not pay back the
> investment (at least not to me, individually), so I think I'd better
> just do it by hand.
I think automating a task that annoys you is worth the trouble. You
could at least start with something like the following, and flesh it out
to include drawer notes and check lists.
--8<---------------cut here---------------start------------->8---
(defun gjg/org-reset-todo ()
"reset any task from point onward with a TODO keyword to
initial TODO state. Show all trees you want to reset before
running this command: hidden trees will not be touched"
(interactive)
(save-excursion
(while (not (eobp))
(outline-next-visible-heading 1)
(if (org-get-todo-state)
(org-todo "TODO")))))
--8<---------------cut here---------------end--------------->8---
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-11 12:36 ` Bernt Hansen
@ 2009-10-11 16:10 ` Robert P. Goldman
2009-10-11 16:46 ` Bernt Hansen
2009-10-11 22:21 ` Nick Dokos
0 siblings, 2 replies; 12+ messages in thread
From: Robert P. Goldman @ 2009-10-11 16:10 UTC (permalink / raw
To: emacs-orgmode
Bernt Hansen <bernt <at> norang.ca> writes:
>
> Paul Mead <paul.d.mead <at> gmail.com> writes:
>
> > Robert Goldman <rpgoldman <at> sift.info> writes:
> >
> >> Andrew Stribblehill wrote:
> >>> org-mode files are plain text. M-% to do a replacement: once you've
> >>> entered your search term and its replacement, hit ! to replace all
> >>> without question.
> >>
> >> Yes, one can do this, but note that it's not entirely a no-brainer. You
> >> need to:
> >>
> >> 1. clear all the check boxes and then recompute all checkbox counts in
> >> the region. [this isn't a simple tag replacement]
> >>
> >> 2. replace all non-TODO keywords with TODO. This is a replacement, but
> >> not a simple one to do with M-%
> >>
> >> 3. Wipe out all of the notes that were added with state changes.
> >> Again, this can be done with a replacement command, but it's not a
> >> trivial one.
> >>
> >> This is one of those cases where automating a task will not pay back the
> >> investment (at least not to me, individually), so I think I'd better
> >> just do it by hand.
> >>
> >> Thanks, everyone,
> >
> > Have you thought about using yasnippet? I have a repeating set of TODOs
> > in a particular order that I have to do every month. Rather than reusing
> > the old structure, I just insert it again from a snippet. That way I
> > also have all my notes from last month too.
>
> Or copy the subtree _before_ you fill it in with details. Make a
> repeating task that is just to copy the subtree at the appropriate time
> so the subtree is available for the repeat after this one, and then
> proceed to use one of the copies for the current task iteration.
Yes, this would clearly have been The Right Thing had I realized when I built
the subtree that I might want to use it again. But I didn't (this seems like a
specific case of the general "code reuse" problem --- it's nice if you can
foresee that you'd like to reuse something but often that does not happen).
The issue about copying, IIUC, is that the template from which one is to copy
must be kept "out of band" with respect to the agenda. That is, it must be kept
somewhere (perhaps in an "org-templates.org" file) where the agenda will not see
it, and copied from the templates file into a file that is active wrt the
agenda. The yasnippet approach fits this. But again, this is a different use
case --- one in which the user has had the foresight to realize that a task will
be used over and over.
Note that no templating approach (automated by yasnippet or not) supports
learning in the course of this code reuse. E.g., if I think of something this
year when I am winterizing, and add that new TODO into my currently active copy
of the template, then it won't appear next year if I reinvoke the template.
In general, I'm inclined to think that this case is irregular enough that it's
probably best to simply keep my one working copy and manually clear it every
year when I need another. It's probably an AI-complete problem to clear an
arbitrary hunk of org back to a pristine state!
Thanks for the discussion,
best,
r
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: "clearing" the state of an org-mode subtree
2009-10-11 16:10 ` Robert P. Goldman
@ 2009-10-11 16:46 ` Bernt Hansen
2009-10-11 22:21 ` Nick Dokos
1 sibling, 0 replies; 12+ messages in thread
From: Bernt Hansen @ 2009-10-11 16:46 UTC (permalink / raw
To: Robert P. Goldman; +Cc: emacs-orgmode
Robert P. Goldman <rpgoldman@sift.info> writes:
> Bernt Hansen <bernt <at> norang.ca> writes:
>
>>
>> Paul Mead <paul.d.mead <at> gmail.com> writes:
>>
>> > Robert Goldman <rpgoldman <at> sift.info> writes:
>> >
>> >> Andrew Stribblehill wrote:
>> >>> org-mode files are plain text. M-% to do a replacement: once you've
>> >>> entered your search term and its replacement, hit ! to replace all
>> >>> without question.
>> >>
>> >> Yes, one can do this, but note that it's not entirely a no-brainer. You
>> >> need to:
>> >>
>> >> 1. clear all the check boxes and then recompute all checkbox counts in
>> >> the region. [this isn't a simple tag replacement]
>> >>
>> >> 2. replace all non-TODO keywords with TODO. This is a replacement, but
>> >> not a simple one to do with M-%
>> >>
>> >> 3. Wipe out all of the notes that were added with state changes.
>> >> Again, this can be done with a replacement command, but it's not a
>> >> trivial one.
>> >>
>> >> This is one of those cases where automating a task will not pay back the
>> >> investment (at least not to me, individually), so I think I'd better
>> >> just do it by hand.
>> >>
>> >> Thanks, everyone,
>> >
>> > Have you thought about using yasnippet? I have a repeating set of TODOs
>> > in a particular order that I have to do every month. Rather than reusing
>> > the old structure, I just insert it again from a snippet. That way I
>> > also have all my notes from last month too.
>>
>> Or copy the subtree _before_ you fill it in with details. Make a
>> repeating task that is just to copy the subtree at the appropriate time
>> so the subtree is available for the repeat after this one, and then
>> proceed to use one of the copies for the current task iteration.
>
>
> Yes, this would clearly have been The Right Thing had I realized when I built
> the subtree that I might want to use it again. But I didn't (this seems like a
> specific case of the general "code reuse" problem --- it's nice if you can
> foresee that you'd like to reuse something but often that does not happen).
>
> The issue about copying, IIUC, is that the template from which one is to copy
> must be kept "out of band" with respect to the agenda. That is, it must be kept
> somewhere (perhaps in an "org-templates.org" file) where the agenda will not see
> it, and copied from the templates file into a file that is active wrt the
> agenda. The yasnippet approach fits this. But again, this is a different use
> case --- one in which the user has had the foresight to realize that a task will
> be used over and over.
>
> Note that no templating approach (automated by yasnippet or not) supports
> learning in the course of this code reuse. E.g., if I think of something this
> year when I am winterizing, and add that new TODO into my currently active copy
> of the template, then it won't appear next year if I reinvoke the template.
>
> In general, I'm inclined to think that this case is irregular enough that it's
> probably best to simply keep my one working copy and manually clear it every
> year when I need another. It's probably an AI-complete problem to clear an
> arbitrary hunk of org back to a pristine state!
>
> Thanks for the discussion,
I have a similar setup for my quarterly accounting tasks - I just have
them scheduled a year in advance so they don't bother my agenda views.
I copy that subtree which moves it forward another year. I keep the
data in-band.
On ** TODO Q1 Accounting 2010
I do C-c C-x c, create 1 clone, and move it forward +1y
This makes 2 copies actually - the one for next year _and_ moves the
repeating task forward another year. Then All I do is change the year
on the top-level task and I'm done.
Then I can work on the entry without the +1y repeater.
,----[ test2.org ]
|
| * Accounting
|
| ** TODO Q1 Accounting 2010
| SCHEDULED: <2009-11-15 Sun +1y>
| - Copy subtree
| *** TODO Year End adjustments
| SCHEDULED: <2009-11-15 Sun>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO October Accounting
| SCHEDULED: <2009-11-15 Sun>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO November Accounting
| SCHEDULED: <2009-12-15 Tue>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO December Accounting
| SCHEDULED: <2010-01-15 Fri>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO File Taxes Oct - Dec
| SCHEDULED: <2010-01-15 Fri>
`----
After the copy (and editing the years on the Q1 Accounting YYYY task) my
file looks like this:
,----[ test2.org ]
|
| * Accounting
|
| ** TODO Q1 Accounting 2010
| SCHEDULED: <2009-11-15 Sun>
| - Copy subtree
| *** TODO Year End adjustments
| SCHEDULED: <2009-11-15 Sun>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO October Accounting
| SCHEDULED: <2009-11-15 Sun>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO November Accounting
| SCHEDULED: <2009-12-15 Tue>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO December Accounting
| SCHEDULED: <2010-01-15 Fri>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO File Taxes Oct - Dec
| SCHEDULED: <2010-01-15 Fri>
| ** TODO Q1 Accounting 2011
| SCHEDULED: <2010-11-15 Mon>
| - Copy subtree
| *** TODO Year End adjustments
| SCHEDULED: <2010-11-15 Mon>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO October Accounting
| SCHEDULED: <2010-11-15 Mon>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO November Accounting
| SCHEDULED: <2010-12-15 Wed>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO December Accounting
| SCHEDULED: <2011-01-15 Sat>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO File Taxes Oct - Dec
| SCHEDULED: <2011-01-15 Sat>
| ** TODO Q1 Accounting 2012
| SCHEDULED: <2011-11-15 Tue +1y>
| - Copy subtree
| *** TODO Year End adjustments
| SCHEDULED: <2011-11-15 Tue>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO October Accounting
| SCHEDULED: <2011-11-15 Tue>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO November Accounting
| SCHEDULED: <2011-12-15 Thu>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO December Accounting
| SCHEDULED: <2012-01-15 Sun>
| - [ ] Step 1
| - [ ] Step 2
| - [ ] Step 3
| ...
| - [ ] Step n
|
| *** TODO File Taxes Oct - Dec
| SCHEDULED: <2012-01-15 Sun>
`----
HTH,
Bernt
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: "clearing" the state of an org-mode subtree
2009-10-11 16:10 ` Robert P. Goldman
2009-10-11 16:46 ` Bernt Hansen
@ 2009-10-11 22:21 ` Nick Dokos
2009-10-12 12:39 ` Robert Goldman
1 sibling, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2009-10-11 22:21 UTC (permalink / raw
To: Robert P. Goldman; +Cc: emacs-orgmode
Robert P. Goldman <rpgoldman@sift.info> wrote:
...
> > > Robert Goldman <rpgoldman <at> sift.info> writes:
> > >
> > >> Andrew Stribblehill wrote:
> > >>> org-mode files are plain text. M-% to do a replacement: once you've
> > >>> entered your search term and its replacement, hit ! to replace all
> > >>> without question.
> > >>
> > >> Yes, one can do this, but note that it's not entirely a no-brainer. You
> > >> need to:
> > >>
> > >> 1. clear all the check boxes and then recompute all checkbox counts in
> > >> the region. [this isn't a simple tag replacement]
> > >>
> > >> 2. replace all non-TODO keywords with TODO. This is a replacement, but
> > >> not a simple one to do with M-%
> > >>
> > >> 3. Wipe out all of the notes that were added with state changes.
> > >> Again, this can be done with a replacement command, but it's not a
> > >> trivial one.
> > >>
> > >> This is one of those cases where automating a task will not pay back the
> > >> investment (at least not to me, individually), so I think I'd better
> > >> just do it by hand.
> > >>
...
Apologies for jumping in without the whole context (I'm buried with work
and I have not been able to even read the whole thread). I'm not sure
how to do #1 and #3 above, but I believe that #2 can be done with the
mapping API (see section A.10 of the org manual) - something like this
(untested and too simple as it stands - probably won't handle headlines
without a todo keyword correctly):
(org-map-entries (lambda () (org-todo "TODO")) t 'tree)
but it may be worth a try. It may even be possible to extend it to do
the other stuff.
HTH,
Nick
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: "clearing" the state of an org-mode subtree
2009-10-11 22:21 ` Nick Dokos
@ 2009-10-12 12:39 ` Robert Goldman
2009-10-12 12:46 ` Carsten Dominik
0 siblings, 1 reply; 12+ messages in thread
From: Robert Goldman @ 2009-10-12 12:39 UTC (permalink / raw
To: nicholas.dokos; +Cc: emacs-orgmode
Nick Dokos wrote:
> Robert P. Goldman <rpgoldman@sift.info> wrote:
>
> ...
>>>> Robert Goldman <rpgoldman <at> sift.info> writes:
>>>>
>>>>> Andrew Stribblehill wrote:
>>>>>> org-mode files are plain text. M-% to do a replacement: once you've
>>>>>> entered your search term and its replacement, hit ! to replace all
>>>>>> without question.
>>>>> Yes, one can do this, but note that it's not entirely a no-brainer. You
>>>>> need to:
>>>>>
>>>>> 1. clear all the check boxes and then recompute all checkbox counts in
>>>>> the region. [this isn't a simple tag replacement]
>>>>>
>>>>> 2. replace all non-TODO keywords with TODO. This is a replacement, but
>>>>> not a simple one to do with M-%
>>>>>
>>>>> 3. Wipe out all of the notes that were added with state changes.
>>>>> Again, this can be done with a replacement command, but it's not a
>>>>> trivial one.
>>>>>
>>>>> This is one of those cases where automating a task will not pay back the
>>>>> investment (at least not to me, individually), so I think I'd better
>>>>> just do it by hand.
>>>>>
> ...
>
> Apologies for jumping in without the whole context (I'm buried with work
> and I have not been able to even read the whole thread). I'm not sure
> how to do #1 and #3 above, but I believe that #2 can be done with the
> mapping API (see section A.10 of the org manual) - something like this
> (untested and too simple as it stands - probably won't handle headlines
> without a todo keyword correctly):
>
> (org-map-entries (lambda () (org-todo "TODO")) t 'tree)
>
> but it may be worth a try. It may even be possible to extend it to do
> the other stuff.
Thanks, that's very helpful. That is indeed what I'm looking for --- I
had been thinking in terms of string replacement, but this reminds me
that there are functions that address org trees semantically, based on
the meaning of the entries.
In addition to org-todo, there's also org-reset-checkbox-state-subtree.
I haven't yet found anything that will find an org-note (so that it can
be removed), but I will look more carefully.
With all of these, it should be possible to put together what I want.
best,
r
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: "clearing" the state of an org-mode subtree
2009-10-12 12:39 ` Robert Goldman
@ 2009-10-12 12:46 ` Carsten Dominik
0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2009-10-12 12:46 UTC (permalink / raw
To: Robert Goldman; +Cc: emacs-orgmode
On Oct 12, 2009, at 2:39 PM, Robert Goldman wrote:
> Nick Dokos wrote:
>> Robert P. Goldman <rpgoldman@sift.info> wrote:
>>
>> ...
>>>>> Robert Goldman <rpgoldman <at> sift.info> writes:
>>>>>
>>>>>> Andrew Stribblehill wrote:
>>>>>>> org-mode files are plain text. M-% to do a replacement: once
>>>>>>> you've
>>>>>>> entered your search term and its replacement, hit ! to replace
>>>>>>> all
>>>>>>> without question.
>>>>>> Yes, one can do this, but note that it's not entirely a no-
>>>>>> brainer. You
>>>>>> need to:
>>>>>>
>>>>>> 1. clear all the check boxes and then recompute all checkbox
>>>>>> counts in
>>>>>> the region. [this isn't a simple tag replacement]
>>>>>>
>>>>>> 2. replace all non-TODO keywords with TODO. This is a
>>>>>> replacement, but
>>>>>> not a simple one to do with M-%
>>>>>>
>>>>>> 3. Wipe out all of the notes that were added with state changes.
>>>>>> Again, this can be done with a replacement command, but it's
>>>>>> not a
>>>>>> trivial one.
>>>>>>
>>>>>> This is one of those cases where automating a task will not pay
>>>>>> back the
>>>>>> investment (at least not to me, individually), so I think I'd
>>>>>> better
>>>>>> just do it by hand.
>>>>>>
>> ...
>>
>> Apologies for jumping in without the whole context (I'm buried with
>> work
>> and I have not been able to even read the whole thread). I'm not sure
>> how to do #1 and #3 above, but I believe that #2 can be done with the
>> mapping API (see section A.10 of the org manual) - something like
>> this
>> (untested and too simple as it stands - probably won't handle
>> headlines
>> without a todo keyword correctly):
>>
>> (org-map-entries (lambda () (org-todo "TODO")) t 'tree)
>>
>> but it may be worth a try. It may even be possible to extend it to do
>> the other stuff.
>
> Thanks, that's very helpful. That is indeed what I'm looking for
> --- I
> had been thinking in terms of string replacement, but this reminds me
> that there are functions that address org trees semantically, based on
> the meaning of the entries.
>
> In addition to org-todo, there's also org-reset-checkbox-state-
> subtree.
> I haven't yet found anything that will find an org-note (so that it
> can
> be removed), but I will look more carefully.
You should be logging into a drawer - drawer are much easier
to find than individual notes.
- Carsten
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-10-12 12:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-09 21:28 "clearing" the state of an org-mode subtree Robert Goldman
2009-10-09 23:43 ` Andrew Stribblehill
2009-10-10 17:23 ` Darlan Cavalcante Moreira
2009-10-10 17:47 ` Robert Goldman
2009-10-11 9:47 ` Paul Mead
2009-10-11 12:36 ` Bernt Hansen
2009-10-11 16:10 ` Robert P. Goldman
2009-10-11 16:46 ` Bernt Hansen
2009-10-11 22:21 ` Nick Dokos
2009-10-12 12:39 ` Robert Goldman
2009-10-12 12:46 ` Carsten Dominik
2009-10-11 15:11 ` Gregory J. Grubbs
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.