Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [joshk@xxxxxxxxxxxxxxx: Bug#271196: makefile completion catches some delayed expansions as targets]
- X-seq: zsh-workers 20358
- From: Clint Adams <clint@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: [joshk@xxxxxxxxxxxxxxx: Bug#271196: makefile completion catches some delayed expansions as targets]
- Date: Sat, 11 Sep 2004 23:24:58 -0400
- Cc: 271196-submitter@xxxxxxxxxxxxxxx, 271196-forwarded@xxxxxxxxxxxxxxx
- In-reply-to: <20040911234745.GA17562@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040911231628.GA17128@xxxxxxxxxxx> <20040911233227.GA17389@xxxxxxxxxxx> <20040911234745.GA17562@xxxxxxxxxxx>
> And only under certain locales.
This avoids what might be a gawk bug by not using awk. Should we move
toward 20277 instead?
Index: Completion/Unix/Command/_make
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_make,v
retrieving revision 1.8
diff -u -r1.8 _make
--- Completion/Unix/Command/_make 21 Aug 2004 03:07:01 -0000 1.8
+++ Completion/Unix/Command/_make 12 Sep 2004 03:17:25 -0000
@@ -1,6 +1,6 @@
#compdef make gmake pmake dmake
-local prev="$words[CURRENT-1]" file expl tmp is_gnu cmdargs useperl
+local prev="$words[CURRENT-1]" file expl tmp is_gnu useperl
zstyle -t ":completion:${curcontext}:" use-perl && useperl=1
_pick_variant -r is_gnu gnu=GNU unix -v -f
@@ -27,11 +27,10 @@
if [[ $is_gnu = gnu ]] &&
zstyle -t ":completion:${curcontext}:targets" call-command; then
if [[ -n $useperl ]]; then
- cmdargs=(perl -ne '/^([a-zA-Z0-9][^\/\t=]+):([^=]|$)/ && print "$1\n"')
+ tmp=( $(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null | perl -ne '/^([a-zA-Z0-9][^\/\t=]+):([^=]|$)/ && print "$1\n"') )
else
- cmdargs=(awk '/^[a-zA-Z0-9][^\/\t=]+:([^=]|$)/ {print $1}' FS=:)
+ tmp=(${${(M)${(f)"$(_call_program targets "$words[1]" -nsp --no-print-directory -f /tmp/rules .PHONY 2>/dev/null)"}:#[a-zA-Z0-9][^/\t=]##:([^=]*|(#e))}%:*})
fi
- tmp=( $(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null | $cmdargs) )
elif [[ -n $useperl ]]; then
tmp=(
$(perl -ne '/^([a-zA-Z0-9][^\/\t=]+):([^=]|$)/ and print "$1\n";
@@ -42,11 +41,9 @@
' $file)
)
else
- tmp=(
- $(awk '/^[a-zA-Z0-9][^\/\t=]+:([^=]|$)/ {print $1}
- /^\.include *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
- print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
- FS=: $file)
+ tmp=( ${${(M)${(f)"$(<$file)"}:#[a-zA-Z0-9][^/\t=]##:([^=]*|(#e))}%:*}
+ $(grep -E '^\.include *(<bsd\.port\.(subdir\.|pre\.)?mk>|".*mk\/bsd\.pkg\.(subdir\.)?mk")' $file >/dev/null &&
+ print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" )
)
fi
_wanted targets expl 'make target' compadd -a tmp && return 0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author