批量反转 Emacs 组织模式中标头的顺序?

sta*_*cko 6 emacs org-mode

有没有办法批量反转 Emacs 组织模式中的标题顺序?我想更改这种列表(但要大得多,不仅仅是两三个项目,因此是“批量”):

* personal computer
 * Windows
 * Mac
 * Linux
* StackExchange
 * stackoverflow
* countries
* people
Run Code Online (Sandbox Code Playgroud)

对此:

* people
* countries
* StackExchange
 * stackoverflow
* personal computer
 * Windows
 * Mac
 * Linux
Run Code Online (Sandbox Code Playgroud)

cla*_*ter 7

选择整个缓冲区并使用 M-x org-sort-entries RET F point RET

org-sort-entries对树中某个级别的所有项目进行排序。'F' 告诉它你想根据你指定的函数以相反的顺序排序。使用该函数point为每个条目提供一个与要排序的缓冲区位置相对应的值。

要从 elisp 中做同样的事情,等效的函数调用是 (org-sort-entries nil ?F 'point)


db4*_*48x -1

当然,M-S-<up>M-S-<down>在其共同父树内上下移动子树。还有很多其他类似的命令;查看信息页面以获取其中的列表 ( M-x info "(org) Structure Editing")。

编辑:我认为实际上颠倒副标题的顺序并不是你可以开箱即用的事情。不过,您也许可以通过使用sort-subr巧妙选择的参数进行调用来做到这一点。