all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Move (the children of) a subtree to another subtree programmatically
@ 2018-09-15  0:41 Marcelo de Moraes Serpa
  2018-09-16 12:34 ` Adam Porter
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo de Moraes Serpa @ 2018-09-15  0:41 UTC (permalink / raw)
  To: Org Mode

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-16 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-15  0:41 Move (the children of) a subtree to another subtree programmatically Marcelo de Moraes Serpa
2018-09-16 12:34 ` Adam Porter

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.