* Re: PATCH: Use "make -p" to get targets
@ 2000-04-11 8:20 Sven Wischnowsky
2000-04-11 15:10 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-04-11 8:20 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> I wrote:
> > We'll just have to set up a style, as in _diff.
>
> Strictly speaking, the _is_gnu branch would work for Solaris make as well
> (as long as nobody actually created a target named .PHONY that had any
> real rules). I suppose you can fake it with the version style:
>
> zstyle ':completion:*:make:version' echo GNU
zstyle '...:version' command echo GNU
> Somebody please "make" a better suggestion.
Hm, dunno, but:
> ...
>
> +if (( ! $+_is_gnu[$1] )); then
Different from _diff_options, _make doesn't get the command-to-call as
the first argument.
And somehow my patch(1) didn't complain that it couldn't apply the
hunks for the _wanted change in _make. Weird.
Bye
Sven
Index: Completion/User/_make
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_make,v
retrieving revision 1.4
diff -u -r1.4 _make
--- Completion/User/_make 2000/04/10 23:40:44 1.4
+++ Completion/User/_make 2000/04/11 08:20:26
@@ -4,12 +4,12 @@
(( $+_is_gnu )) || typeset -gA _is_gnu
-if (( ! $+_is_gnu[$1] )); then
- if [[ $(_call version $1 -v -f /dev/null </dev/null 2>/dev/null) = *GNU* ]]
+if (( ! $+_is_gnu[$words[1]] )); then
+ if [[ $(_call version $words[1] -v -f /dev/null </dev/null 2>/dev/null) = *GNU* ]]
then
- _is_gnu[$1]=yes
+ _is_gnu[$words[1]]=yes
else
- _is_gnu[$1]=
+ _is_gnu[$words[1]]=
fi
fi
@@ -31,7 +31,7 @@
file=''
fi
- if [[ -n "$file" ]] && _wanted targets; then
+ if [[ -n "$file" ]] && _tags targets; then
if [[ -n "$_is_gnu[$1]" ]]; then
tmp=( $(make -nsp --no-print-directory -f "$file" .PHONY | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
else
@@ -42,7 +42,7 @@
FS=: $file)
)
fi
- _all_labels targets expl 'make target' compadd "$tmp[@]" && return 0
+ _wanted targets expl 'make target' compadd "$tmp[@]" && return 0
fi
compset -P 1 '*='
_files
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: Use "make -p" to get targets
2000-04-11 8:20 PATCH: Use "make -p" to get targets Sven Wischnowsky
@ 2000-04-11 15:10 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-04-11 15:10 UTC (permalink / raw)
To: zsh-workers
On Apr 11, 10:20am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: Use "make -p" to get targets
}
} > ...
} >
} > +if (( ! $+_is_gnu[$1] )); then
}
} Different from _diff_options, _make doesn't get the command-to-call as
} the first argument.
Ooops. You missed one, though:
Index: Completion/User/_make
===================================================================
@@ -32,7 +32,7 @@
fi
if [[ -n "$file" ]] && _tags targets; then
- if [[ -n "$_is_gnu[$1]" ]]; then
+ if [[ -n "$_is_gnu[$words[1]]" ]]; then
tmp=( $(make -nsp --no-print-directory -f "$file" .PHONY | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
else
tmp=(
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH: Use "make -p" to get targets
@ 2000-04-10 23:35 Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-04-10 23:35 UTC (permalink / raw)
To: zsh-workers
I wrote:
> We'll just have to set up a style, as in _diff.
Strictly speaking, the _is_gnu branch would work for Solaris make as well
(as long as nobody actually created a target named .PHONY that had any
real rules). I suppose you can fake it with the version style:
zstyle ':completion:*:make:version' echo GNU
Somebody please "make" a better suggestion.
Index: Doc/Zsh/compsys.yo
===================================================================
@@ -715,6 +715,11 @@
when completing a value out of a set of values (or a list of such
values)
)
+kindex(version, completion tag)
+item(tt(version))(
+used by tt(_call) to look up the command to run to determine the installed
+version of various other commands (currently tt(diff) and tt(make)).
+)
kindex(warnings, completion tag)
item(tt(warnings))(
used to look up the tt(format) style for warnings
Index: Completion/User/_make
===================================================================
@@ -1,7 +1,18 @@
-#compdef make gmake pmake
+#compdef make gmake pmake dmake
local prev="$words[CURRENT-1]" file expl tmp
+(( $+_is_gnu )) || typeset -gA _is_gnu
+
+if (( ! $+_is_gnu[$1] )); then
+ if [[ $(_call version $1 -v -f /dev/null </dev/null 2>/dev/null) = *GNU* ]]
+ then
+ _is_gnu[$1]=yes
+ else
+ _is_gnu[$1]=
+ fi
+fi
+
if [[ "$prev" = -[CI] ]]; then
_files -/
elif [[ "$prev" = -[foW] ]]; then
@@ -14,17 +25,23 @@
file=Makefile
elif [[ -e makefile ]]; then
file=makefile
+ elif [[ -e GNUmakefile ]]; then
+ file=GNUmakefile
else
file=''
fi
if [[ -n "$file" ]] && _wanted targets; then
- tmp=(
- $(awk '/^[a-zA-Z0-9][^\/\t]+:/ {print $1}
+ if [[ -n "$_is_gnu[$1]" ]]; then
+ tmp=( $(make -nsp --no-print-directory -f "$file" .PHONY | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
+ 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)
- )
+ )
+ fi
_all_labels targets expl 'make target' compadd "$tmp[@]" && return 0
fi
compset -P 1 '*='
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-04-11 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-11 8:20 PATCH: Use "make -p" to get targets Sven Wischnowsky
2000-04-11 15:10 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
2000-04-10 23:35 Bart Schaefer
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).