0

Suppose we have

* Parent1
** Child1

and that our point is at Child1. Is there a way to programmatically move Child1 to be a sibling above Parent1, as follows:

* Child1
* Parent1

?

EDIT: The algorithm proposed in the comments fails when centered on Child1 (since it takes Child2 along with it):

* Parent
** Child1
*** Subchild
** Child2
  • Maybe this is it(?) - Adjust keybind: (global-set-key (kbd "M-P") (lambda () (interactive) (org-shiftmetaleft) (org-move-subtree-up))) – kai-dj Feb 1 '18 at 22:03
  • @kai-dj: There are cases where that fails but it does get us closer :) – George Feb 1 '18 at 22:05
  • What cases you imagine it to fail? – kai-dj Feb 1 '18 at 22:07
  • ok - ye, did not see that ^^ well there must be a way to move the item to bottom of current hierarchy – and then do (org-shiftmetaleft) (org-move-subtree-up) – kai-dj Feb 2 '18 at 15:04
1

This doesn't fail your usecase, I hope (adjust keybind etc.):

(global-set-key (kbd "M-P")
        (lambda ()
          (interactive)
          (condition-case nil
              (while t (org-move-subtree-down))
            (error nil))
          (org-shiftmetaleft)
          (org-move-subtree-up)))

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.