Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: global alias with leading space gives unexpected thing
- X-seq: zsh-workers 27929
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Dmitry Bolshakov <bdimych@xxxxxxxx>
- Subject: Re: global alias with leading space gives unexpected thing
- Date: Wed, 28 Apr 2010 00:02:00 +0200
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=XAjkdgK96078YXq3jXtsHIOG3HN5dDBOj8F4U873XZA=; b=mgbnW77xLef+o8FZCW/kf+1nOdxvmR2TRZfUMpvBmxUatYSG2VK+opCXFn9VkyAoox Twy3uUvKhsJR6g81NkjpIsjK7H0rFGT02zkTzQ7HpSURkqVP2OfS5k4wiIqcAsScKhJp muvEzHe7GDM++FPrKAKEdSu26bTNT+knus9X4=
- 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 :cc:content-type; b=F/wI5FU/NdUg7Jnw8WuDVO883pVhhEwclWJ0CugJfyD7Aq9s/o0A7y4THoIlBprxWf /a54+YBebSHNIrwFoji3neEHGRUkat+xplwbyP4Ct3V5Zdvx3jM0th9FFaX1V2Gu/ymN 1TMhptf/k+8cG98FVmCMSimM3SF4aF+FL7T6M=
- In-reply-to: <44891272404484@xxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <44891272404484@xxxxxxxxxxxxxxxx>
On 27 April 2010 23:41, Dmitry Bolshakov <bdimych@xxxxxxxx> wrote:
> hi
> there it is, copy-paste this into the shell
>
> ====================================================
> setopt histignorespace
>
>
>
> : ---------- if there is leading space in the alias
> alias -g X=' >/dev/null'
> true X
> history -1
> : ---------- then the command with the alias is absent in the history
>
>
>
> : ---------- if no leading space
> alias -g X='>/dev/null'
> true X
> history -1
> : ---------- then the command is present
>
>
>
> : ---------- if leading space, but the histignorespace is off
> alias -g X=' >/dev/null'
> setopt no_histignorespace
> true X
> history -1
> : ---------- then also present
>
> ====================================================
>
>
> this seems strange a bit for me
> i always imagined that a count of spaces does not matter
>
> all
>
> somecommand >/dev/null
> somecommand >/dev/null
> somecommand >/dev/null
>
> are the same, isn't it so?
>
>
> --
> with best regards
> Dmitry Bolshakov
>
Maybe something like this is needed?
diff --git a/Src/lex.c b/Src/lex.c
index 8f43251..83257da 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1774,7 +1774,7 @@ exalias(void)
if (an && !an->inuse &&
((an->node.flags & ALIAS_GLOBAL) || incmdpos || inalmore)) {
inpush(an->text, INP_ALIAS, an);
- if (an->text[0] == ' ')
+ if (an->text[0] == ' ' && !(an->node.flags & ALIAS_GLOBAL))
aliasspaceflag = 1;
lexstop = 0;
if (zshlextext == copy)
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author