emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Move (the children of) a subtree to another subtree programmatically


From: Marcelo de Moraes Serpa
Subject: [O] Move (the children of) a subtree to another subtree programmatically
Date: Fri, 14 Sep 2018 19:41:58 -0500

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]