Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: auto-quoting inside braces in arguments
- X-seq: zsh-users 26540
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: auto-quoting inside braces in arguments
- Date: Fri, 19 Feb 2021 13:17:05 +0100
- Archived-at: <https://zsh.org/users/26540>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-02/20210219121705.GA1706306%40zira.vinc17.org>
- In-reply-to: <CAH+w=7ZD5oFJitNmVSQbRuiY+OoY4_KaEYGXZ3JwA4dD=bAGdw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- References: <20210218134039.GA1492462@zira.vinc17.org> <8b3a9f93-5eb4-4d4d-8312-58c371e12239@www.fastmail.com> <CAH+w=7ZD5oFJitNmVSQbRuiY+OoY4_KaEYGXZ3JwA4dD=bAGdw@mail.gmail.com>
On 2021-02-18 10:30:50 -0800, Bart Schaefer wrote:
> On Thu, Feb 18, 2021 at 9:35 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Vincent Lefevre wrote on Thu, 18 Feb 2021 13:40 +00:00:
> > > Is there a way to get auto-quoting inside braces in arguments?
> >
> > Proof of concept:
> >
> > f() {
> > local l=\{ r=\}
> > CURSOR=${BUFFER[(i)$l]} MARK=${BUFFER[(i)$r]}
> > (( -- CURSOR ))
> > zle quote-region
> > }
>
> It needs to be a bit more complicated than that, because you first
> have to be sure that the braces are not already quoted and do not form
> a valid comma-separated (or ".." range) brace expression. Also,
> should anything special happen if there is a valid brace expression
> inside the invalid brace pair? Is this single- or double-quote
> equivalent, or something new?
I think that { would just appear as a quote mechanism until a
matching }. This should probably similar to double-quote.
For instance
echo {ab cd"ef }" $ZSH_VERSION {0..2} }
should be equivalent to
echo "{ab cdef } $ZSH_VERSION {0..2} }"
though in practice, there would be only something simple inside { }.
For instance:
svn diff -r{1 hour ago}
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author