💾 Archived View for gemlog.blue › users › verachell › 1644767723.gmi captured on 2024-03-21 at 17:18:43. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

How to automatically re-do the auto-indent for the entire file in emacs

Note: This post is a Gemini space version of my post originally published on August 14, 2018 at

https version of this post

Let's suppose you're making changes to your code in emacs and... now your code indentation is all out of whack. It would be too laborious to re-do the indentation manually.

Rest assured, you can easily have the whole file automatically re-indented in emacs, as described in a StackExchange question

https - Can I have emacs automatically indent my whole code after it is all written? Stack Exchange

The command for this is first to select the entire file, then to tell it to re-indent the region, as follows.

Select the entire file:

ctrl-x h

Re-do the auto-indentation:

alt-x indent-region

The correct Emacs terminology is M-x indent-region, but I've called it alt-x here because that's the exact keys I would press on the keyboard.