help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: editing previous command in the *shell* buffer


From: Robert Thorpe
Subject: Re: editing previous command in the *shell* buffer
Date: Wed, 29 Apr 2015 01:20:43 +0100

cplum987@gmail.com writes:

> [BTW, I meant C-r, not C-s. My brain can never recall why my fingers type.]
>
> M-r seems to be a step in the right direction. However, you don't know
> what command line it will grab until after you press <RET>. As an
> example, I just tried  "M-r cd<RET>". It found a command with "CD" in
> the middle of it. I wanted the one that started with "cd".

It's a regex as Barry Margolin mentioned, that's one way to narrow
things down.  Another is to search further.  M-r initiates a backwards
regex isearch of history.  When you meet a match C-r will continue the
search back to the next match.  (Typing M-r again switches from regex
search to normal search).

There are quite a few other commands available.  See (info "(emacs)
Shell Ring")

> With xemacs, "cd M-p" would have found the most recent occurrence of a
> command that started with "cd", and entered it as the current command
> so I can edit it (it doesn't take you to the location in *shell* of
> the match like C-r does). No need to press <RET> first and hope it
> grabs the right one. Also, each time I type M-p after that, it will
> grab an even older instance of a command that starts with those same
> chars. So I just type the first few chars of the command, and then
> type M-p until xemacs finds the one I want.

This sounds useful.  There's probably a package on Melpa or Marmalade to
do it.  But I don't know precisely where to start looking.

BR,
Robert Thorpe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]