zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Dmitry Bolshakov <bdimych@narod.ru>
Cc: zsh-workers@zsh.org
Subject: Re: global alias with leading space gives unexpected thing
Date: Wed, 28 Apr 2010 00:02:00 +0200	[thread overview]
Message-ID: <h2s237967ef1004271502ydadadad3p7612f7f824e33a7d@mail.gmail.com> (raw)
In-Reply-To: <44891272404484@web144.yandex.ru>

On 27 April 2010 23:41, Dmitry Bolshakov <bdimych@narod.ru> 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


  reply	other threads:[~2010-04-27 22:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 21:41 Dmitry Bolshakov
2010-04-27 22:02 ` Mikael Magnusson [this message]
2010-04-28  8:56   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=h2s237967ef1004271502ydadadad3p7612f7f824e33a7d@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=bdimych@narod.ru \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).