From 254b3f1a6b85e6cfefe21fea3d81c3f97c003ec2 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 10 Nov 2006 09:59:26 +0000 Subject: 22992: make $? available in exit traps/hooks 22993: slightly more effective _make variable fix --- Completion/Unix/Command/_make | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_make') diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 91c434559..93d4b52da 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -51,6 +51,12 @@ expandVars() { done } +# parseMakefile only runs inside $(...), so it doesn't matter that +# it pollutes the global namespace, setting zsh variables to +# make variables. The difficult case is where a make variable +# is special in zsh; we use local -h to hide those. This +# isn't a complete solution since it means variables defined in +# included Makefiles are undefined before returning to the parent. parseMakefile() { local input var val TAB=$'\t' dir=$1 @@ -60,7 +66,7 @@ parseMakefile() { var=${input%%[ $TAB]#=*} val=${input#*=} val=${val##[ $TAB]#} - local -h $var + [[ ${(tP)var} = *special ]] && local -h $var eval $var=\$val ;; ([[:alnum:]][[:alnum:]_]#[ $TAB]#:=*) @@ -68,7 +74,7 @@ parseMakefile() { val=${input#*=} val=${val##[ $TAB]#} val=$(expandVars 10 $val) - local -h $var + [[ ${(tP)var} = *special ]] && local -h $var eval $var=\$val ;; ([[:alnum:]][^$TAB:=]#:[^=]*) -- cgit 1.4.1