From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: "clearing" the state of an org-mode subtree Date: Sun, 11 Oct 2009 12:46:38 -0400 Message-ID: <87zl7xvpxt.fsf@gollum.intra.norang.ca> References: <4ACFAB1B.7010604@sift.info> <1f38ae890910091643r611e0cadlbe52727c30d6b9f6@mail.gmail.com> <4AD0C8CF.5080106@sift.info> <877hv24607.fsf@gmail.com> <87fx9qw1j8.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mx1ZJ-0000YH-0k for emacs-orgmode@gnu.org; Sun, 11 Oct 2009 12:46:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mx1ZF-0000RE-5Z for emacs-orgmode@gnu.org; Sun, 11 Oct 2009 12:46:48 -0400 Received: from [199.232.76.173] (port=51891 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mx1ZE-0000Qy-VU for emacs-orgmode@gnu.org; Sun, 11 Oct 2009 12:46:44 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:55129) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mx1ZE-0006dz-Id for emacs-orgmode@gnu.org; Sun, 11 Oct 2009 12:46:44 -0400 In-Reply-To: (Robert P. Goldman's message of "Sun\, 11 Oct 2009 16\:10\:39 +0000 \(UTC\)") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Robert P. Goldman" Cc: emacs-orgmode@gnu.org Robert P. Goldman writes: > Bernt Hansen norang.ca> writes: > >> >> Paul Mead gmail.com> writes: >> >> > Robert Goldman 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