11
votes

I love emacs shells, but there is a confusing thing for people used to use the gnome shell (like me). The backwards search does not work the same way. C-r searches in the buffer, not in the command history, and M-r searches in the command history but when pressed twice toggles between direct and regexp search, i.e. does not search for the previous match in the command history. So, how to do that?

Edit: The shell I was looking when I wrote this is what you get with M-x shell, I didn't know there were other shells in emacs. See e.g. https://plus.google.com/112537550357635435516/posts/Wgpk2mH6hQh

2
isearch-backward / search-backward / search-backward-regexpalinsoar

2 Answers

14
votes

Type M-r , search for something, and then press C-r to repeat the same search in the command history.

3
votes

Press M-r, then write something, then press C-r as many times as needed.