Emacs Advent Calendar 06: Fixing Typos

Sun 2015-12-06

Emacs comes with some useful commands to fix common typos.

Correcting case is done with M-c, M-l and M-u. They apply case conversion from point to the end of the current word. M-c capitalizes, M-l and M-u convert to lower case and upper case respectively.

To correct the word before point, use M-- ("M-minus") as a prefix.

Characters can be transposed with C-t. The character behind point is swapped with the character in front of/under point.

The same is true for words: The word in front of point is swapped with the word behind point by pressing M-t.

To revert recent changes in a buffer the undo command is used. It is bound to C-x u and C-/. After undoing the change, point is moved to the position where it was before the change.

If a sequence of undos is broken by another command, the undo operations themselves are put on the undo stack and can be undone again.

If the region is active only changes inside are reverted.

More information can be found in sections 16.1 (Undo), 16.2 (Transpose) and 16.3 (Fixing case) of the Emacs Reference Manual.


This text by Ludger Sandig is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.