From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25670 invoked by alias); 27 Apr 2010 22:09:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27929 Received: (qmail 15120 invoked from network); 27 Apr 2010 22:08:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.218.213 as permitted sender) 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= MIME-Version: 1.0 In-Reply-To: <44891272404484@web144.yandex.ru> References: <44891272404484@web144.yandex.ru> Date: Wed, 28 Apr 2010 00:02:00 +0200 Message-ID: Subject: Re: global alias with leading space gives unexpected thing From: Mikael Magnusson To: Dmitry Bolshakov Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 27 April 2010 23:41, Dmitry Bolshakov 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