-- Leo's gemini proxy

-- Connecting to gemlog.blue:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

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.

-- Response ended

-- Page fetched on Sun Jun 2 09:36:26 2024