Using examples from octave mode to explain this, but it would be useful in other places as well.
When going through the command history it would be nice to only display entries that match what's already been typed. For example,
if I've typed out x=
pressing M-p would go to the last commands beginning with that, eg x=3
or x=y+4
, even if several unrelated commands have been entered.
What's the simplest way to achieve this in emacs?
M-x comint-previous-matching-input
. (You'll probably want to bind that to some appropriate key.)M-p
andM-n
work? I think you should also be able to search the history by pressingM-r
and typing the part of the expression you already typed before.