bug-bash
[Top][All Lists]
Advanced

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

Re: About `M-C-e` expand result `'` failed


From: Mike Jonkmans
Subject: Re: About `M-C-e` expand result `'` failed
Date: Fri, 2 Feb 2024 14:12:37 +0100

On Thu, Feb 01, 2024 at 08:14:34PM -0500, Chet Ramey wrote:
> On 1/31/24 6:05 PM, Mike Jonkmans wrote:
> 
> > The first sentence under EXPANSION may make you think otherwise:
> >    Expansion is performed on the command line after it has been split into 
> > words.
> >    There are seven kinds of expansion performed: brace expansion,
> >    tilde expansion, parameter and variable expansion, command substitution,
> >    arithmetic expansion, word splitting, and pathname expansion.
> > The third sentence, after this, corrects this:
> >    After these expansions are performed, quote characters present in the 
> > original
> >    word are removed unless they have been quoted themselves (quote removal).
> > That sentence could also be placed right after the first.
> I can rearrange things, but it seems clear already.

"There are seven kinds of expansion..." then three sentences later comes
quote removal. The reader may wonder whether quote removal is an expansion.

That question pops up in the description of shell-expand-line:
   Expand the line as the shell does. This performs alias and history
   expansion as well as all of the shell word expansions. 

Now "... all of the shell word expansions", could be read as the seven kinds
of expansion.

Maybe it is confusing that a (quote) removal is an expansion. Oh well.

> > Returning to `shell-expand-line'.
> > As end user I would expect that, running shell-expand-line then accept-line,
> > would do the same as just an accept-line.
> Why would you expect this? You have deliberately introduced an extra
> expansion step, similar to using `eval'.

I might expect that, because it would be useful to see what is going to be
executed. Then after review of the expansion, I could accept it.
But that is not possible, in general, with shell-expand-line, as OP has shown.

> > I think that escaping is needed after quote removal in shell-expand-line.
> No, that would be another function.

Maybe less is more ;)


PS.
Just found out that `shell-expand-line' does not do pathname expansion.
That was unexpected.
In the `shell-expand-line' description:
   '... word expansions.'
Does that mean every expansion but pathname expansion?


-- 
Regards, Mike Jonkmans



reply via email to

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