liuminzhao
liuminzhao

Reputation: 2455

reverse notes order in org mode

I make my notes in this order:

* FIRST
* SECOND
* THIRD
...
* LAST

what I want when I export to html or latex is the reverse order:

* LAST
...
* FIRST

so

  1. is there any way or command to reverse the order in org file directly ?
  2. is there any way to reverse the order while I export the org file to html/latex ?

either should be fine I think.

Upvotes: 9

Views: 1237

Answers (2)

xeruf
xeruf

Reputation: 2990

An alternative for evil users:

  • Fold all headlines (S-TAB) and go to the last one (G)
  • qq Record macro to register q
  • "Pddk Append current headline to register p and go a line up
  • q Save macro
  • @q and then X@@ with X being the number of remaining headlines
  • "pp Paste from register p

Upvotes: 0

Oleg Pavliv
Oleg Pavliv

Reputation: 21162

I don't think there is a predefined command you are looking for. You can implement it by yourself.

If it's a one-time task I would use emacs macro:

You show only top-level headlines. Then you go to the first headline and start macro C-x ( . You select the line C-SPACE C-n and you type C-u M-x prepend-to-register . C-u deletes the line as well. You stop the macro C-x ) .

Now you repeat the macro for all top-level headlines M-0 C-x e .

And you insert the register C-x r i .

Upvotes: 11

Related Questions