Previous: , Up: Text   [Contents][Index]


20.7 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.

M-l

Convert following word to lower case (downcase-word).

M-u

Convert following word to upper case (upcase-word).

M-c

Capitalize the following word (capitalize-word).

C-x C-l

Convert region to lower case (downcase-region).

C-x C-u

Convert region to upper case (upcase-region).

The word conversion commands are used most frequently. Meta-l (downcase-word) converts the word after point to lower case, moving past it. Thus, repeating Meta-l converts successive words. Meta-u (upcase-word) converts to all capitals instead, while Meta-c (capitalize-word) puts the first letter of the word into upper case and the rest into lower case. The word conversion 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: 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 Meta-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 (downcase-region), which convert everything between point and mark to the specified case. Point and mark do not move.


Previous: , Up: Text   [Contents][Index]