From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo de Moraes Serpa Subject: Move (the children of) a subtree to another subtree programmatically Date: Fri, 14 Sep 2018 19:41:58 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ce43d90575de3592" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0yf5-0003LH-L9 for emacs-orgmode@gnu.org; Fri, 14 Sep 2018 20:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g0yf4-0007Wc-Sy for emacs-orgmode@gnu.org; Fri, 14 Sep 2018 20:42:11 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:39650) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g0yf4-0007WL-NP for emacs-orgmode@gnu.org; Fri, 14 Sep 2018 20:42:10 -0400 Received: by mail-ot1-x32b.google.com with SMTP id c12-v6so6252305otl.6 for ; Fri, 14 Sep 2018 17:42:10 -0700 (PDT) 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: Org Mode --000000000000ce43d90575de3592 Content-Type: text/plain; charset="UTF-8" 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. --000000000000ce43d90575de3592 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 orgf= ile for me everyday with the current date and gives it focus. In the case b= elow, 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-subtr= ee` but for some reason emacs hangs. I couldn't figure out how to use `= org-refile` programmatically though.

Considering I= have access in=C2=A0elisp=C2=A0to both a `to` and `from` variables, where = `to` is `<2018-01-01>` and from is `<2017-12-31>` and that I wa= nt to move all *non-DONE` items from `from` to `to`, how would I go about d= oing that?

Thanks in adance!

<= div>- Marcelo.

--000000000000ce43d90575de3592--