Suppose you had a large org document of recipes, with hundreds of entries like this:

* Tasty Pudding
** Ingredients
- Milk
- Sugar
- Eggs
- Flavorings
** Process
1. Mix the eggs and sugar
2. Heat up the milk and flavorings
3. Temper the milk into the egg mixture
4. Cook the pudding
** Description
It's my favorite pudding

But then you realize the description subheading is pointless and your recipes should be structured more like

* Tasty Pudding
It's still my favorite pudding, but it makes more
sense to have the description up here!
** Ingredients
** Process
** Notes
Here's my new additional thoughts about this

Is it possible to either edit all of these entries at once, or ideally have some kind of "node" structure that these recipes are bound to?

So for example, I could see having a Yas Snippet like:

* $1
** Ingredients
- $3
** Process
1. $4
** Notes

But of course that would only work for your new recipes, it can't fix the old ones.

  • 2
    The general approach to this kind of problem is to use org-map-entries to walk through the interesting entries (in your case, the top-level entries), passing it a function to do the transformation you require (get the text of the second-level Description entry, delete the entry and copy the text at the top). But this is only a bare-bones comment of how to do it, so there is some significant amount of Lisp programming you would have to do.
    – NickD
    Jan 5, 2019 at 16:41

1 Answer 1


I defined a macro.

  • At the beginning of the document and start the macro (F3),
  • Search (C+s) for the string * Description (I hope you don't have another structure with name starting with Description) and hit enter (RET),
  • Move the section up twice, (M+up x 2)
  • Go to the beginning of the line (C+a) and kill it (C+k),
  • End the macro (F4),
  • Select the buffer (C+h) and apply the macro (M+x apply-macro-to-region-lines RET)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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