Indent several lines in Emacs

2019-03-08 04:42发布

问题:

In my Emacs, space key can indent correctly 1 line. If I select several lines, and press space key, the indenting does not work.

By following this link, I try C-M-\ or C-M-q, but C-M deletes directly the whole block selected.

Here is my .emacs, could anyone help?

回答1:

If you want Emacs to correctly indent multiple lines, then the command is C-META \ also known as C-M-\. In other words, it's not Control - M, but Control - Meta - Backslash (Control + Alt + \ on most keyboards)



回答2:

Select multiply lines, then type C-u 8 C-x Tab, it will indent the region by 8 spaces.

C-u -4 C-x Tab will un-indent by 4 spaces



回答3:

None of the above method worked for me except Kev's- and that is too verbose for my slow fingers.

For me, I can highlight the region and press Alt-left arrow . Strangely, even though Altt registers as meta in emacsm, Esc-left arrow doesn't work.