5

With this tree structure:

* A
** A.1
** A.2
** A.3
a3a3a3a3a3a3a3
* B
* C
** C.1
*** C.1.1
*** C.1.2
*** C.1.3
** C.2
** C.3

… I can move C.1 (with its children) up and down with M-↑ and M-↓. Easy.

If I use M-S-↑ and M-S-↓, only the C.1 node is moved, without its children. Easy, too, however the Manual claims in http://orgmode.org/manual/Structure-editing.html:

M-S-<up> (org-move-subtree-up)

Move subtree up (swap with previous subtree of same level).

M-S-<down> (org-move-subtree-down)

Move subtree down (swap with next subtree of same level).

… so, really, it should be the other way round. Nevermind, though.

Also, using M-S-↑↓, the C.1 node can be moved out of its parent, C. When this happens, the C.1 node always keeps its level (** in this case), no matter where it ends up.

Now, what I want to achieve is to move the whole C.1 subtree, the whole branch with all the children, similarly, out of C, while keeping its ** level.

This could be done with org-refile or killing the subtree C-c C-x C-w and yanking it at some new point, however, nothing beats the experience (especially when I’ve got to move hundreds of such trees after importing my notes from Wunderlist).

Using GNU Emacs 25.0.50.1 and Org-mode version 8.3.2 (8.3.2-10-g00dacd-elpa).

  • how do you import notes from wunderlist? thanks! – netawater Nov 8 '15 at 15:02
  • @netawater, I did import them using my script, github.com/michalrus/org-import-wunderlist . If you want to synchronize it regularly, use org-wunderlist, but that doesn’t work well for me. – Michal Rus Nov 8 '15 at 20:48
3

Try This

Using arrow keys to edit a nested tree structure can be confusing but is worth learning.

  1. Place the cursor on C.1 line.

    Note: The cursor will remain on C.1 line unless otherwise noted.

    * A
    ** A.1
    ** A.2
    ** A.3
    a3a3a3a3a3a3a3
    * B
    * C
    ** C.1
    *** C.1.1
    *** C.1.2
    *** C.1.3
    ** C.2
    ** C.3
    
  2. Move C.1 down to bottom of C with by typing M-↓ repeatedly to preserve C.2 and C.3 branches.

    Outline should look like:

    * A
    ** A.1
    ** A.2
    ** A.3
    a3a3a3a3a3a3a3
    * B
    * C
    ** C.2
    ** C.3
    ** C.1
    *** C.1.1
    *** C.1.2
    *** C.1.3
    
  3. Outdent entire C.1 subtree by typing M-S-←.

    Outline should look like:

    * A
    ** A.1
    ** A.2
    ** A.3
    a3a3a3a3a3a3a3
    * B
    * C
    ** C.2
    ** C.3
    * C.1
    ** C.1.1
    ** C.1.2
    ** C.1.3
    
  4. Move C.1 subtree above C subtree by typing M-↑

    Outline should look like:

    * A
    ** A.1
    ** A.2
    ** A.3
    a3a3a3a3a3a3a3
    * B
    * C.1
    ** C.1.1
    ** C.1.2
    ** C.1.3
    * C
    ** C.2
    ** C.3
    
  5. Indent C.1 subtree under another subtree, e.g. B, by typing M-S-→

    Outline should look like:

    * A
    ** A.1
    ** A.2
    ** A.3
    a3a3a3a3a3a3a3
    * B
    ** C.1
    *** C.1.1
    *** C.1.2
    *** C.1.3
    * C
    ** C.2
    ** C.3
    

I'll add some additional tips and examples to my answer soon.

Tested using

GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0, NS apple-appkit-1343.14)

org-version: 8.3.1

  • A bit weird, but, I guess, it's the only way. Thanks! I don't know, however, why M-S-↓↑ won't move the whole subtree. It would be really convenient. – Michal Rus Oct 20 '15 at 15:38
  • @MichalRus, agreed, because C-x C-t (transpose-lines) already does what M-S-<up>/<down> does. – systemovich May 9 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.