From mboxrd@z Thu Jan 1 00:00:00 1970 From: mediapathic steen Subject: Re: Need help understanding how to limit a function to a tree Date: Thu, 1 Mar 2018 01:15:48 -0800 Message-ID: <6CDE89C8-A333-471F-8EB5-01ED7FECD5A1@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erKJg-0000KI-KM for emacs-orgmode@gnu.org; Thu, 01 Mar 2018 04:16:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erKJc-00007W-8k for emacs-orgmode@gnu.org; Thu, 01 Mar 2018 04:15:56 -0500 Received: from mail-pl0-x22e.google.com ([2607:f8b0:400e:c01::22e]:36162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erKJc-00007C-2q for emacs-orgmode@gnu.org; Thu, 01 Mar 2018 04:15:52 -0500 Received: by mail-pl0-x22e.google.com with SMTP id 61-v6so3304663plf.3 for ; Thu, 01 Mar 2018 01:15:52 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: org-mode-email This worked a treat, and I learned a bit more. Thanks so much! -- Steen > On Feb 28, 2018, at 7:35 PM, John Kitchin = wrote: >=20 > You probably want this: >=20 > #+BEGIN_SRC emacs-lisp > (defun my-redo () > (interactive) > (org-map-entries > (lambda () > (org-todo "TODO")) > "TODO=3D\"DONE\"" ;; the match argument > 'tree)) ;; the scope > #+END_SRC >=20 > Then call: >=20 > M-x my-redo=20 >=20 > in the tree you want to reset. >=20 >=20 >=20 > John >=20 > ----------------------------------- > Professor John Kitchin=20 > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu >=20 >=20 > On Wed, Feb 28, 2018 at 4:36 PM, mediapathic steen = wrote: > I have a subtree that contains a daily list of things to do (which I = keep as TODOs rather than checklist form for more granular time = tracking). I want to reset all of the DONE to TODO every day when I = start it. Right now I have this piece of code I copypasted from = somewhere now lost (possibly this very group): >=20 > (org-map-entries (lambda () > (when > (string=3D > (nth 2 (org-heading-components)) "DONE") > (org-todo "TODO")))) >=20 > This more or less makes sense to me. I have this code sitting in the = subtree, and in order to do my daily reset, I edit the subtree in an = indirect buffer, eval-region the code, then kill the buffer. >=20 > What I would like to accomplish: > 1) Can you help me understand how to modify this code so that it only = applies to the subtree it's run in (parents also would be fine in this = case but not necessary and seems more of a challenge)? Doing the = indirect buffer thing seems more hassle than is reasonable. >=20 > 2) I think I understand how to put this in my init in such a way that = I can C-x invoke it, rather than having to eval-region it, but I'm not = certain. Can you point me toward a reasonable tutorial or hints on how = to do that in general? >=20 > Thanks in advance, > -- Steen >=20