From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: _diff (new), _prcs (upgrade)
Date: Thu, 27 Jan 2000 17:08:36 +0100 (MET) [thread overview]
Message-ID: <200001271608.RAA19165@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Alexandre Duret-Lutz's message of 27 Jan 2000 15:52:23 +0100
Alexandre Duret-Lutz wrote:
> Here is a diff completion fonction. I have separated _diff_options
> (complete options) from _diff (also complete filenames), so that
> completion functions like _prcs may use only _diff_options.
Testing this revealed a thinko in _files -- sometimes ignored-patterns
was effectively ignored.
The rest of the patch just makes some of the descriptions more
verbose. I hope this is ok for Alexandre (?).
Oh, and it makes _diff_options use `$(command diff ...)' -- I at least
have a small wrapper function for it which makes it fail otherwise.
Bye
Sven
diff -ru ../z.old/Completion/Core/_files Completion/Core/_files
--- ../z.old/Completion/Core/_files Thu Jan 27 16:48:00 2000
+++ Completion/Core/_files Thu Jan 27 17:02:48 2000
@@ -1,6 +1,7 @@
#autoload
local opts opt type=file glob group gopts dopts aopts tmp _file_pat_checked=yes
+local hasign ign
opts=()
group=()
@@ -9,11 +10,12 @@
aopts=(-f)
while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do
case "$opt" in
- /) type="${type}dir" ;;
- g) type="${type}glob"; gopts=(-g "$OPTARG") ;;
- [qn12]) opts=("$opts[@]" "-$opt" ) ;;
- [JV]) group=( "-$opt" "$OPTARG") ;;
- [^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;;
+ /) type="${type}dir" ;;
+ g) type="${type}glob"; gopts=(-g "$OPTARG") ;;
+ [qn12]) opts=("$opts[@]" "-$opt" ) ;;
+ [JV]) group=( "-$opt" "$OPTARG") ;;
+ F) opts=("$opts[@]" "-$opt" "$OPTARG"); hasign=yes ;;
+ [^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;;
esac
done
@@ -60,32 +62,44 @@
if (( $#group )); then
group[2]=all-files
_setup all-files
+ [[ -z "$hasign" ]] &&
+ zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+ ign=(-F _comp_ignore)
fi
- _path_files "$opts[@]" "$aopts[@]"
+ _path_files "$opts[@]" "$ign[@]" "$aopts[@]"
return
elif _requested directories; then
if _requested globbed-files; then
if (( $#group )); then
group[2]=globbed-files
_setup globbed-files
+ [[ -z "$hasign" ]] &&
+ zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+ ign=(-F _comp_ignore)
fi
- _path_files "$opts[@]" "$dopts[@]" "$gopts[@]" && return 0
+ _path_files "$opts[@]" "$ign[@]" "$dopts[@]" "$gopts[@]" && return 0
else
if (( $#group )); then
group[2]=directories
_setup directories
+ [[ -z "$hasign" ]] &&
+ zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+ ign=(-F _comp_ignore)
fi
- _path_files "$opts[@]" "$dopts[@]" && return 0
+ _path_files "$opts[@]" "$ign[@]" "$dopts[@]" && return 0
fi
elif _requested globbed-files; then
if (( $#group )); then
group[2]=globbed-files
_setup globbed-files
+ [[ -z "$hasign" ]] &&
+ zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+ ign=(-F _comp_ignore)
fi
if [[ "$type" = (*dir*glob*|*glob*dir*) ]]; then
- _path_files "$opts[@]" "$dopts[@]" "$gopts[@]" && return 0
+ _path_files "$opts[@]" "$ign[@]" "$dopts[@]" "$gopts[@]" && return 0
else
- _path_files "$opts[@]" "$gopts[@]" && return 0
+ _path_files "$opts[@]" "$ign[@]" "$gopts[@]" && return 0
fi
fi
done
diff -ru ../z.old/Completion/User/_diff_options Completion/User/_diff_options
--- ../z.old/Completion/User/_diff_options Thu Jan 27 16:48:13 2000
+++ Completion/User/_diff_options Thu Jan 27 16:52:50 2000
@@ -4,7 +4,7 @@
(( $+_diff_is_gnu )) || {
_diff_is_gnu=0;
- [[ $(diff -v </dev/null) == *GNU* ]] && _diff_is_gnu=1
+ [[ $(command diff -v </dev/null) == *GNU* ]] && _diff_is_gnu=1
}
if (( _diff_is_gnu ))
@@ -50,15 +50,15 @@
'(--ignore-space-change)-b[ignore changes in the amount of white space]' \
'(-B)--ignore-blank-lines[ignore lines that are all blank]' \
'(--ignore-blank-lines)-B[ignore lines that are all blank]' \
- '(-I)--ignore-matching-lines=[ignore lines that match regex]:regex:' \
- '(--ignore-matching-lines)-I[ignore lines that match regex]:regex:' \
+ '(-I)--ignore-matching-lines=[ignore lines that match regex]:line exclusion regex:' \
+ '(--ignore-matching-lines)-I[ignore lines that match regex]:line exclusion regex:' \
'(-a)--text[treat all files as text]' \
'(--text)-a[treat all files as text]' \
- "($of $oss)--context=[context diff]::# lines of copied context:" \
- "($of $oss)-C[output a context diff]:# lines of copied context:" \
+ "($of $oss)--context=[context diff]::number of lines of copied context:" \
+ "($of $oss)-C[output a context diff]:number of lines of copied context:" \
"($of $oss)-c[output a context diff]" \
- "($of $oss)--unified=[output a unified diff]::# lines of unified context:" \
- "($of $oss)-U[output a unified diff]:# lines of unified context:" \
+ "($of $oss)--unified=[output a unified diff]::number of lines of unified context:" \
+ "($of $oss)-U[output a unified diff]:number of lines of unified context:" \
"($of $oss)-u[output a unified diff]" \
"($ofwuc $oss -L)--label[set label to use instead of file name]:label:" \
"($ofwuc $oss --label)-L[set label to use instead of file name]:label:" \
@@ -75,18 +75,18 @@
"($of $ouc $oss)-n[RCS format diff]" \
"($of $ouc)--side-by-side[output in two columns]" \
"($of $ouc)-y[output in two columns]" \
- "($ofwy $ouc -W)--width[set size of line]:# characters per line:" \
- "($ofwy $ouc --width)-W[set size of line]:# characters per line:" \
+ "($ofwy $ouc -W)--width[set size of line]:number of characters per line:" \
+ "($ofwy $ouc --width)-W[set size of line]:number of characters per line:" \
"($ofwy $ouc)--left-column[output only left column of common lines]" \
"($ofwy $ouc)--suppress-common-lines[do not ouput commun lines]" \
- "($ofwg $ouc $oss)--old-group-format=[set old group format]:group format:" \
- "($ofwg $ouc $oss)--new-group-format=[set new group format]:group format:" \
- "($ofwg $ouc $oss)--changed-group-format=[set changed group format]:group format:" \
- "($ofwg $ouc $oss)--unchanged-group-format=[set unchanged group format]:group format:" \
+ "($ofwg $ouc $oss)--old-group-format=[set old group format]:old group format:" \
+ "($ofwg $ouc $oss)--new-group-format=[set new group format]:new group format:" \
+ "($ofwg $ouc $oss)--changed-group-format=[set changed group format]:changed group format:" \
+ "($ofwg $ouc $oss)--unchanged-group-format=[set unchanged group format]:unchanged group format:" \
"($ofwl $ouc $oss)--line-format=[set line format]:line format:" \
- "($ofwl $ouc $oss)--old-line-format=[set old line format]:line format:" \
- "($ofwl $ouc $oss)--new-line-format=[set new line format]:line format:" \
- "($ofwl $ouc $oss)--changed-line-format=[set changed line format]:line format:" \
+ "($ofwl $ouc $oss)--old-line-format=[set old line format]:old line format:" \
+ "($ofwl $ouc $oss)--new-line-format=[set new line format]:new line format:" \
+ "($ofwl $ouc $oss)--changed-line-format=[set changed line format]:changed line format:" \
'(-l)--paginate[output through pr]' \
'(--paginate)-l[output through pr]' \
'(-t)--expand-tabs[expand tabs to spaces]' \
@@ -101,13 +101,13 @@
'(--unidirectional-new-file)-P[treat absent first files as empty]' \
'(-s)--report-identical-files[report when two files are the same]' \
'(--report-identical-files)-s[report when two files are the same]' \
- '(-x)--exclude=[exclude files matching pattern]:pattern:' \
- '(--exclude)-x[exclude files matching pattern]:pattern:' \
- '(-X)--exclude-from=[exclude files matching pattern in file]:file:_files' \
- '(--exclude-from)-X[exclude files matching pattern in file]:file:_files' \
- '(-S)--starting-file=[set first file in comparison]:file:_files' \
- '(--starting-file)-S=[set first file in comparison]:file:_files' \
- '--horizon-lines=[set number of lines to keep in prefix and suffix]:number:' \
+ '(-x)--exclude=[exclude files matching pattern]:exclusion pattern:' \
+ '(--exclude)-x[exclude files matching pattern]:exclusion pattern:' \
+ '(-X)--exclude-from=[exclude files matching pattern in file]:exclude file:_files' \
+ '(--exclude-from)-X[exclude files matching pattern in file]:exclude file:_files' \
+ '(-S)--starting-file=[set first file in comparison]:start with file:_files' \
+ '(--starting-file)-S=[set first file in comparison]:start with file:_files' \
+ '--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines:' \
'(-d)--mininal[try to find a smaler set of changes]' \
'(--mininal)-d[try to find a smaler set of changes]' \
'(-H)--speed-large-files[assume large files and many small changes]' \
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-01-27 16:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-27 16:08 Sven Wischnowsky [this message]
2000-01-27 17:21 ` Alexandre Duret-Lutz
2000-01-29 8:49 ` Alexandre Duret-Lutz
-- strict thread matches above, loose matches on Subject: below --
2000-01-31 9:09 Sven Wischnowsky
2000-01-28 15:11 Sven Wischnowsky
2000-01-28 16:24 ` Alexandre Duret-Lutz
2000-01-28 10:25 Sven Wischnowsky
2000-01-28 15:04 ` Alexandre Duret-Lutz
2000-01-28 8:26 Sven Wischnowsky
2000-01-28 9:49 ` Alexandre Duret-Lutz
2000-01-27 14:52 Alexandre Duret-Lutz
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=200001271608.RAA19165@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).