I don’t get a good answer after a short google-searching, so I ask it here.
Normally, when I want to format current file, I will do:
c-x h c-m-\
It formats current file, but I lose my cursor position. For example, I’m editing a long file, and I’m in line 157 now. When I reformatted the file, I found my cursor jumped to line 1. I’ve to move it manually to line 157, which is not convenient.
How can I do it?
You can use this function and bind it to a single keypress: