emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: mediapathic steen <mediapathic@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Need help understanding how to limit a function to a tree
Date: Wed, 28 Feb 2018 16:36:26 -0800	[thread overview]
Message-ID: <B5C77280-23FE-4A67-9418-C9D176253BAB@gmail.com> (raw)

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

(org-map-entries (lambda ()
          (when
              (string=
               (nth 2 (org-heading-components)) "DONE")
               (org-todo "TODO"))))

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. 

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. 

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?

Thanks in advance,
-- Steen

             reply	other threads:[~2018-03-01  0:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  0:36 mediapathic steen [this message]
2018-03-01  3:35 ` Need help understanding how to limit a function to a tree John Kitchin
2018-03-01  9:15   ` mediapathic steen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5C77280-23FE-4A67-9418-C9D176253BAB@gmail.com \
    --to=mediapathic@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).