30.6 Case Conversion Commands
Emacs has commands for converting either a single word or any arbitrary
range of text to upper case or to lower case.
- Convert following word to lower case (
- Convert following word to upper case (
- Capitalize the following word (
- C-x C-l
- Convert region to lower case (
- C-x C-u
- Convert region to upper case (
The word conversion commands are the most useful. M-l
downcase-word) converts the word after point to lower case, moving
past it. Thus, repeating M-l converts successive words.
upcase-word) converts to all capitals instead, while
capitalize-word) puts the first letter of the word
into upper case and the rest into lower case. All these commands convert
several words at once if given an argument. They are especially convenient
for converting a large amount of text from all upper case to mixed case,
because you can move through the text using M-l, M-u or
M-c on each word as appropriate, occasionally using M-f instead
to skip a word.
When given a negative argument, the word case conversion commands apply
to the appropriate number of words before point, but do not move point.
This is convenient when you have just typed a word in the wrong case: you
can give the case conversion command and continue typing.
If a word case conversion command is given in the middle of a word, it
applies only to the part of the word which follows point. This is just
like what M-d (
kill-word) does. With a negative argument,
case conversion applies only to the part of the word before point.
The other case conversion commands are C-x C-u
upcase-region) and C-x C-l (
convert everything between point and mark to the specified case. Point and
mark do not move.
The region case conversion commands
downcase-region are normally disabled. This means that they ask
for confirmation if you try to use them. When you confirm, you may
enable the command, which means it will not ask for confirmation again.