Thanks, I didn't know about history-expand-line.

Is there some case where shell-expand-line would actually be useful?
If I've typed *"foo bar"*, I can't think of any case where I'd *want*
it to be replaced by *foo bar*, which has a very different meaning.
Of course the obvious answer is not to use it, but I'm wondering why
it's there.

I might just rearrange my key bindings so shell-expand-line is never
invoked (Escape-^ is just a little bit too awkward to type, and my
fingers are trained to type Escape-Ctrl-E). I guess I won't suggest any
change to bash, since it breaking existing documented behavior is
A Bad Thing.

(BTW, I've been using different fonts and *bold* for emphasis. Let me know
if that's a problem and you'd prefer just plain text on this list.)


On Wed, Nov 4, 2015 at 6:45 AM, Pádraig Brady <p...@draigbrady.com> wrote:

> On 04/11/15 13:47, Chet Ramey wrote:
> > On 11/3/15 7:44 PM, Keith Thompson wrote:
> >> The shell-expand-line command (bound to Escape-Ctrl-E) incorrectly
> removes
> >> quotation marks from
> >> the command line, often resulting in a command that differs from what
> the
> >> user intended to type.
> >
> > This is the documented behavior.  shell-expand-line performs all of the
> > shell word expansions, including quote removal.
>
> How useful is that though when the expansion gives a different meaning?
>
> >> I often type Escape-Ctrl-E to expand a history substitution in place
> >> before typing Enter, but it has the side effect of stripping quotes from
> >> what I've already typed.
> >
> > If you want to perform history expansion, try M-^ (history-expand-line).
>
> Yes this is useful. I've set it up to happen automatically with
> this in my .inputrc
>
> $if Bash
>   # do history expansion when space entered
>   Space: magic-space
> $endif
>
> cheers,
> Pádraig.
>



-- 
Keith Thompson <keith.s.thomp...@gmail.com>

Reply via email to