I was looking at the promotion/demotion of items in the hierarchy. Indeed I haven’t tested the change of order. This could be indeed useful, in my opinion. Along the same lines one would like similar commands for other environments, like slides or table row/columns, i.e. two keybindings to change the order among the siblings of a given subtree (for table row/cols this is trickier). You can also want to give a look at how the macro which exchange numerator and denominator of a fraction in `Help->Scheme extension->TeXmacs editing model`

, e.g.

```
(define (swap-numerator-denominator)
(with-innermost t 'frac
(with p (tree-cursor-path t)
(tree-set! t `(frac ,(tree-ref t 1) ,(tree-ref t 0)))
(tree-go-to t (cons (- 1 (car p)) (cdr p))))))
```

Something similar could work. Also do not hesitate to peek into `$TEXMACS_PATH/progs/...`

to see how some commands which look similar the one you would like to implement are coded.