From: Marcelo de Moraes Serpa <celoserpa@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Move (the children of) a subtree to another subtree programmatically
Date: Fri, 14 Sep 2018 19:41:58 -0500 [thread overview]
Message-ID: <CACHMzOGifL_gV6MY6JKHT1=WPmD_spEsgDK+9CSDhsFhFJj3eA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]
Hi there,
I'm trying to figure out the best way to move the children of a subtree to
another one. The use-case is simple: I have another lisp function that
creates a new item in an orgfile for me everyday with the current date and
gives it focus. In the case below, it'd have created `<2018-01-01`> above
`<2017-12-31>`, that works already:
* <2018-01-01>
* <2017-12-31>
** TODO Foobar
** DONE Barfoo
As part of that, I'd also want to move all TODO items from the previous day
to the next day. I'm not sure how to do it though. I tried using
`org-map-entries` with an `if` to exclude the direct parent (the date item)
and then use `org-cut-subtree` and `org-paste-subtree` but for some reason
emacs hangs. I couldn't figure out how to use `org-refile` programmatically
though.
Considering I have access in elisp to both a `to` and `from` variables,
where `to` is `<2018-01-01>` and from is `<2017-12-31>` and that I want to
move all *non-DONE` items from `from` to `to`, how would I go about doing
that?
Thanks in adance!
- Marcelo.
[-- Attachment #2: Type: text/html, Size: 1308 bytes --]
next reply other threads:[~2018-09-15 0:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-15 0:41 Marcelo de Moraes Serpa [this message]
2018-09-16 12:34 ` Move (the children of) a subtree to another subtree programmatically Adam Porter
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACHMzOGifL_gV6MY6JKHT1=WPmD_spEsgDK+9CSDhsFhFJj3eA@mail.gmail.com' \
--to=celoserpa@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 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.