zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Global-alias problem with _expand
Date: Tue, 10 Oct 2000 17:04:34 +0200 (MET DST)	[thread overview]
Message-ID: <200010101504.RAA25484@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Tue, 10 Oct 2000 14:29:01 +0000


Bart Schaefer wrote:

> On Oct 10, 10:13am, Sven Wischnowsky wrote:
> }
> } Rats. Look:
> } 
> }   % alias -g 'T=|foo'
> }   % eval 'exp=( T )'
> }   zsh: parse error near `|'
> } 
> } Anyone know how to avoid that?
> 
> By redirecting stderr on the eval?

Now where did I get the impression from that the error kept the rest
from the function from being executed? Sigh.

Bye
 Sven

Index: Completion/Core/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_expand,v
retrieving revision 1.31
diff -u -r1.31 _expand
--- Completion/Core/_expand	2000/10/10 09:00:15	1.31
+++ Completion/Core/_expand	2000/10/10 15:03:52
@@ -12,7 +12,6 @@
 [[ _matcher_num -gt 1 ]] && return 1
 
 local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre
-local gal
 
 (( $# )) &&
     while getopts gsco opt; do
@@ -49,12 +48,6 @@
        ( "$word" = *\$[a-zA-Z0-9_]## && 
          ${#parameters[(I)${word##*\$}*]} -ne 1 ) ]] && return 1 }
 
-# We have to temporarily remove the global aliases because they can make
-# the evals fail.
-
-gal=( ${(kv)galiases} )
-(( $#gal )) && builtin unalias ${(k)galiases}
-
 # In exp we will collect the expansions.
 
 exp=("$word")
@@ -66,7 +59,7 @@
 if [[ "$force" = *s* ]] ||
    zstyle -T ":completion:${curcontext}:" substitute; then
   [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
-      eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \)
+      eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \) 2>/dev/null
   eval 'exp=( ${${(e)exp//\\[ 	
 ]/ }//(#b)([ 	
 ])/\\$match[1]} )' 2>/dev/null
@@ -90,20 +83,14 @@
 
 (( $#exp )) || exp=("$subd[@]")
 
-if [[ $#exp -eq 1 && "${exp[1]//\\}" = "${word//\\}"(|\(N\)) ]]; then
-  galiases=( $gal )
-  return 1
-fi
+[[ $#exp -eq 1 && "${exp[1]//\\}" = "${word//\\}"(|\(N\)) ]] && return 1
 
 # With subst-globs-only we bail out if there were no glob expansions,
 # regardless of any substitutions
 
-if { [[ "$force" = *o* ]] ||
-    zstyle -t ":completion:${curcontext}:" subst-globs-only } &&
-    [[ "$subd" = "$exp"(|\(N\)) ]]; then
-  galiases=( $gal )
-  return 1
-fi
+{ [[ "$force" = *o* ]] ||
+  zstyle -t ":completion:${curcontext}:" subst-globs-only } &&
+  [[ "$subd" = "$exp"(|\(N\)) ]] &&  return 1
 
 zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed
 if [[ "$word" = [\~\$]*/* && "$tmp" = (yes|true|on|1|changed) ]]; then
@@ -114,12 +101,7 @@
     [[ "$tmp" != changed || $#exp -gt 1 ||
        "${opre}${exp[1]#${pre}}" != "$word" ]] && exp=( ${opre}${^exp#${pre}} )
   fi
-
-  galiases=( $gal )
-
   [[ $#exp -eq 1 && "$exp[1]" = "$word" ]] && return 1
-else
-  galiases=( $gal )
 fi
 
 # Now add as matches whatever the user requested.

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-10-10 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-10 15:04 Sven Wischnowsky [this message]
2000-10-10 15:47 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-10-10  8:13 Sven Wischnowsky
2000-10-10 14:29 ` Bart Schaefer
2000-10-09 16:17 Wayne Davison

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=200010101504.RAA25484@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).