Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#537596: regression: parse error near `()' in function definition
- X-seq: zsh-workers 27179
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Bug#537596: regression: parse error near `()' in function definition
- Date: Mon, 20 Jul 2009 11:10:47 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=CYs8dGvutkG/OGDagwMw1RU7AxCXogiiXMrD59YqCQY=; b=pHHYsMRwbaB4M7RTdwT+66/30gVuks+dbIdaRnolxmlkknmsRpxXotE72vlORXaa2L nA365cmI4jh+dTQh+xFDZe82mg1YXVj0gFrGO5VQArrKOoCanIPY1s6oVTIJghJ70wcc Zab+6/mTizC2Nn3aQ0odds5q4UJrbZqYArDTQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=pktN+fBaNaVcmHcxcFdtLu9poyhXI4oGUrancVxNGYpWHsxZ6QFz9yTIJQIES214uk o/raFc2gu1AcNq8YEXPqf0qmS13ljqySLPRQtb/3ONlOierqf5nEjl8RCTsCHCZloGDP HrgHMLWlxQwjmbifZ8I7UPfE5Djxq7/m4Gn24=
- In-reply-to: <200907200850.n6K8ovIg028836@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20090719171651.GA7217@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20090719232041.GA5156@xxxxxxxx> <20090720092757.77e812c7@news01> <237967ef0907200137j245d1bgc43303d2b9805249@xxxxxxxxxxxxxx> <200907200850.n6K8ovIg028836@xxxxxxxxxxxxxx>
2009/7/20 Peter Stephenson <pws@xxxxxxx>:
> Mikael Magnusson wrote:
>> Just thought I'd mention you can also use \ at any time to escape an alias:
>
> Something like that is worth mentioning.
>
> Index: Etc/FAQ.yo
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Etc/FAQ.yo,v
> retrieving revision 1.47
> diff -u -r1.47 FAQ.yo
> --- Etc/FAQ.yo 21 Apr 2009 09:33:37 -0000 1.47
> +++ Etc/FAQ.yo 20 Jul 2009 08:50:23 -0000
> @@ -819,6 +819,14 @@
> use in the body of a function, but define the function first if the
> alias has the same name as the function.
>
> + If you aware of the problem, you can always escape part or all of the
> + name of the function:
> + verb(
> + 'l'() { /bin/ls -la "$@" | more }
> + )
> + Adding the quotes has no effect on the function definition, but
> + suppresses alias expansion for the function name. Hence this is
> + guaranteed to be safe.
I didn't look up more of the context than what is in the diff hunk, so
maybe this guarantee only holds for aliases of l, but not generally:
% alias l='echo hello'
% alias \'l\'='echo bye'
% l
hello
% 'l'
bye
% 'l'() {print i am a function}
% l
i am a function
% 'l'
i am a function
% "'l'"
zsh: command not found: 'l'
% which l
l: aliased to echo hello
% which 'l'
l: aliased to echo hello
% which "'l'"
'l': aliased to echo bye
What happened at this point:
% 'l'() {print i am a function}
was of course that i defined "echo" (and "bye"):
% which echo
echo () {
print i am a function
}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author