Useful Commands For The Emacs Minibuffer

I have long used 【Meta+p】 to recall previously entered information in the minibuffer. For example, when I’m editing Groff input it’s often convenient to typeset what I have so far to check that the result looks good or just to read what I’ve written without the markup. I do that by selecting the entire buffer with 【Ctrl+x h】, piping the buffer to groff with 【Meta+|】, and then specifying the command

groff -ms -pset -X | gxditview

It’s a pain to keep typing that so after the first time I just type 【Meta+p】 to bring up the pipeline again.

You can, of course, move forward in the minibuffer history with 【Meta+n】 but there are some other not so obvious ways of navigating the minibuffer. The command 【Meta+rregexpReturn】 will search backward in the minibuffer history for the entry matching the regular expression regexp. Similarly, 【Meta+sregexpReturn】 will search forward for the entry matching regexp. You can continue either of these searches to the next match with 【Meta+r Return】 or 【Meta+s Return】.

Finally, you can repeat the last echoed message with 【Ctrl+h e

Summary

Key Sequence Operation
Meta+p Backward one entry
Meta+n Forward one entry
Meta+rregexpReturn Search backwards for regexp
Meta+sregexpReturn Search forward for regexp
Meta+r Return Repeat backward REGEXP search
Meta+s Return Repeat foreard REGEXP search
Ctrl+h e Show last echoed message

Update: 【Meta+s】 → 【Meta+n】 in summary

This entry was posted in General and tagged . Bookmark the permalink.