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: cplum987
Subject: Re: editing previous command in the *shell* buffer
Date: Tue, 28 Apr 2015 12:39:58 -0700 (PDT)
User-agent: G2/1.0

On Tuesday, April 28, 2015 at 10:10:22 AM UTC-7, HASM wrote:
> 
> > How can I do one or both of the following:
> >
> > (1) Find a previous command in the *shell* buffer via search
> > C-s, and have pressing enter insert the command as the
> > current command, but without execution.
> 
> Doesn't M-r work for you?
>   M-r runs the command comint-history-isearch-backward-regexp,
> -- HASM

[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".

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.


reply via email to

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