Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I change Emacs so that the regexp search (instead of normal search) is the default?

I would like to be able to type C-s [0-9], for example, and it takes me to the next number. Then, press C-s again, and it takes me to the next number.

I tried this:

(global-set-key "\C-s" 'search-forward-regexp)

But the repeated pressing of C-s does not work. It does find the first occurrence, but to find the second you have to re-enter the regexp [0-9] after pressing C-s.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You're close - use isearch-forward-regexp - note the 'i'.

Found via 'C-h k C-M-s' which is bound to interactive regexp search forward.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.