Emacs: Find Replace and Change Letter Case

By Xah Lee. Date: . Last updated: .

Problem

make each line start with capital letter.

change

some thing in the water
does not compute

to

Some thing in the water
Does not compute

Solution

Alt+x query-replace-regexp

type Ctrl+q Ctrl+j to insert a linefeed.

type

\([a-z]\) Return

in the replace prompt, type

\,(concat "\n" (upcase \1))

or use downcase

Emacs, find replace with a lisp expression examples

Emacs Find Replace