views:

144

answers:

2

In Emacs, by default, incremental search is case-insensitive. However, if you type any upper case characters as part of the search string, it becomes a case-sensitive search. So the question is, how do you easily perform a case-sensitive search of an all lower case pattern. The fewer the characters and easier to remember the better. I'm pretty sure this is built in, just can't recall how to do it.

A: 

Have (setq case-fold-search nil) in your .emacs or M-x set-variable case-fold-search nil.

Ashwin
I'm looking for an on the fly answer, i.e. normally I do want insensitive, but occasionally I wish to do lowercase sensitive momentarily.
WilliamKF
set-variable should do the trick for you. You can set a keyboard shortcut for it and switch between the two type of searches.
Ashwin
+6  A: 

Emacs' incremental search (that is, isearch-forward) has a lot of modifiers to change the current search's behavior which you can type on the fly immediately after C-s.

From isearch-forward's documentation:

Type M-c to toggle search case-sensitivity.

Török Gábor