zsh-workers
 help / color / mirror / code / Atom feed
* cvs completion does not support partial path completion
@ 2001-04-26 14:05 Andrej Borsenkow
  2001-04-27 12:20 ` Sven Wischnowsky
  0 siblings, 1 reply; 14+ messages in thread
From: Andrej Borsenkow @ 2001-04-26 14:05 UTC (permalink / raw)
  To: ZSH Workers Mailing List


Is "nice to have" in released version ...

bor@itsrm2% cvs diff S/M/t.c (meaning Src/Modules/termcap.c)
No matches for: `cvs command', `file', `directory', or `removed file'

zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' '+r:|[._-]=** r:|=**'

-andrej

Have a nice DOS!
B >> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: cvs completion does not support partial path completion
  2001-04-26 14:05 cvs completion does not support partial path completion Andrej Borsenkow
@ 2001-04-27 12:20 ` Sven Wischnowsky
  2001-04-27 13:08   ` Andrej Borsenkow
  2001-04-27 17:54   ` Bart Schaefer
  0 siblings, 2 replies; 14+ messages in thread
From: Sven Wischnowsky @ 2001-04-27 12:20 UTC (permalink / raw)
  To: zsh-workers

Andrej Borsenkow wrote:

> Is "nice to have" in released version ...
> 
> bor@itsrm2% cvs diff S/M/t.c (meaning Src/Modules/termcap.c)
> No matches for: `cvs command', `file', `directory', or `removed file'

As far as I can see, the problem is in _cvs, which I always try to avoid
coming near to.  Have a look if you wish, you might have to have to deal
with interesting functions such as:

_cvs_modified_entries () {
  if _cvs_loadstat; then
    local expl match linedir realdir pat
    match=()
    : ${PREFIX:#(#b)(*/)(*)}
    linedir="$match[1]"
    realdir=${(e)~linedir}
    [[ -f "$realdir"CVS/Entries ]] &&
    [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
    _wanted files expl file _path_files -g "$pat"
  else
    _cvs_existing_entries
  fi
}

As far as I can see, that directory handling would require re-thinking
(or just placing a call to _files somewhere at the end as a catch-all
case when the clever functions failed, but placing it somewhere where it
won't get called more than once and not too early etc.).

Bye
  Sven


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: cvs completion does not support partial path completion
  2001-04-27 12:20 ` Sven Wischnowsky
@ 2001-04-27 13:08   ` Andrej Borsenkow
  2001-04-27 13:22     ` Sven Wischnowsky
  2001-04-27 17:54   ` Bart Schaefer
  1 sibling, 1 reply; 14+ messages in thread
From: Andrej Borsenkow @ 2001-04-27 13:08 UTC (permalink / raw)
  To: zsh-workers


>     _wanted files expl file _path_files -g "$pat"
                                          ^^^^^^^^^

Is not this the reason? As I understand, global matchers are noy used when
explicit pattern matching is requested?

-andrej


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: RE: cvs completion does not support partial path completion
  2001-04-27 13:08   ` Andrej Borsenkow
@ 2001-04-27 13:22     ` Sven Wischnowsky
  0 siblings, 0 replies; 14+ messages in thread
From: Sven Wischnowsky @ 2001-04-27 13:22 UTC (permalink / raw)
  To: zsh-workers

Andrej Borsenkow wrote:

> >     _wanted files expl file _path_files -g "$pat"
>                                           ^^^^^^^^^
> 
> Is not this the reason? As I understand, global matchers are noy used when
> explicit pattern matching is requested?

No.  And you want partial path-completion which doesn't have to do with
your matcher-list style (you get that always, if you have a matcher-list
or not).  The problem is that _cvs uses the directory path of the word
from the line unmodified and then searches for files in `S/M/...' put
without expanding partial paths (and I'm not suggesting that it should
do that -- the _files-as-default-at-the-end I mentioned is probably the
best that can be done, or maybe try first with sticking `*'s before the
slashes or something).

Bye
  Sven


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: cvs completion does not support partial path completion
  2001-04-27 12:20 ` Sven Wischnowsky
  2001-04-27 13:08   ` Andrej Borsenkow
@ 2001-04-27 17:54   ` Bart Schaefer
  2001-04-30  8:17     ` Sven Wischnowsky
  1 sibling, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2001-04-27 17:54 UTC (permalink / raw)
  To: zsh-workers

On Apr 27,  2:20pm, Sven Wischnowsky wrote:
} Subject: Re: cvs completion does not support partial path completion
}
} Andrej Borsenkow wrote:
} 
} > Is "nice to have" in released version ...
} > 
} > bor@itsrm2% cvs diff S/M/t.c (meaning Src/Modules/termcap.c)
} > No matches for: `cvs command', `file', `directory', or `removed file'
} 
} As far as I can see, that directory handling would require re-thinking
} (or just placing a call to _files somewhere at the end as a catch-all
} case when the clever functions failed, but placing it somewhere where it
} won't get called more than once and not too early etc.).

It's not that bad ... at this point:

_cvs_modified_entries () {
  if _cvs_loadstat; then
      local expl match linedir realdir pat
      match=()
      : ${PREFIX:#(#b)(*/)(*)}
      linedir="$match[1]"
      realdir=${(e)~linedir}

Instead of using ${(e)~linedir) to get the realdir, tack /CVS on the end
and use _path_files to generate realdir, then lop off the CVS again and
proceed.

Of course "use _path_files to generate realdir" means editing _path_files
to accept the `-A array' option and pass it through to compadd ... and
fixing all the _cvs functions to handle an array of realdirs rather than
a single one.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: cvs completion does not support partial path completion
  2001-04-27 17:54   ` Bart Schaefer
@ 2001-04-30  8:17     ` Sven Wischnowsky
  2001-04-30 16:56       ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: Sven Wischnowsky @ 2001-04-30  8:17 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> ...
> 
> It's not that bad ... at this point:
> 
> _cvs_modified_entries () {
>   if _cvs_loadstat; then
>       local expl match linedir realdir pat
>       match=()
>       : ${PREFIX:#(#b)(*/)(*)}
>       linedir="$match[1]"
>       realdir=${(e)~linedir}
> 
> Instead of using ${(e)~linedir) to get the realdir, tack /CVS on the end
> and use _path_files to generate realdir, then lop off the CVS again and
> proceed.
> 
> Of course "use _path_files to generate realdir" means editing _path_files
> to accept the `-A array' option and pass it through to compadd ... and
> fixing all the _cvs functions to handle an array of realdirs rather than
> a single one.

_path_files uses -A itself.  This could get really messy.

So, as a incomplete, but simple solution I'd still favour sticking a
call to _files somewhere.


Bye
  Sven


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: cvs completion does not support partial path completion
  2001-04-30  8:17     ` Sven Wischnowsky
@ 2001-04-30 16:56       ` Bart Schaefer
  2001-05-01  9:39         ` Tanaka Akira
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2001-04-30 16:56 UTC (permalink / raw)
  To: zsh-workers

On Apr 30, 10:17am, Sven Wischnowsky wrote:
} Subject: Re: cvs completion does not support partial path completion
}
} _path_files uses -A itself.  This could get really messy.
} 
} So, as a incomplete, but simple solution I'd still favour sticking a
} call to _files somewhere.

Hmm.  There actually are calls to _files and _path_files sprinkled about
though the _cvs function family.  I suspect at least some subset of the
commands actually does complete partial paths.  On the other hand, there
are some cvs subcommands for which files should not be completed.

That makes it more difficult to decide where to put a call to _files.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: cvs completion does not support partial path completion
  2001-04-30 16:56       ` Bart Schaefer
@ 2001-05-01  9:39         ` Tanaka Akira
  2001-05-04  5:16           ` PATCH: " Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: Tanaka Akira @ 2001-05-01  9:39 UTC (permalink / raw)
  To: zsh-workers

In article <1010430165626.ZM4866@candle.brasslantern.com>,
  "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

> Hmm.  There actually are calls to _files and _path_files sprinkled about
> though the _cvs function family.  I suspect at least some subset of the
> commands actually does complete partial paths.  On the other hand, there
> are some cvs subcommands for which files should not be completed.
> 
> That makes it more difficult to decide where to put a call to _files.

The functions which have troubles with partial path completion are
functions which use CVS/Entries: _cvs_files, _cvs_files_modified,
_cvs_files_removed and _cvs_files_unmaintained.  So fallback call to
_files should be placed at end of them.  However _cvs_files_removed is
more problematic since it completes non-existing (but listed in
CVS/Entries) files, though.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 14+ messages in thread

* PATCH: Re: cvs completion does not support partial path completion
  2001-05-01  9:39         ` Tanaka Akira
@ 2001-05-04  5:16           ` Bart Schaefer
  2001-05-04 16:26             ` Bart Schaefer
  2001-05-04 16:39             ` Bart Schaefer
  0 siblings, 2 replies; 14+ messages in thread
From: Bart Schaefer @ 2001-05-04  5:16 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

On May 1,  6:39pm, Tanaka Akira wrote:
}
} The functions which have troubles with partial path completion are
} functions which use CVS/Entries: _cvs_files, _cvs_files_modified,
} _cvs_files_removed and _cvs_files_unmaintained.  So fallback call to
} _files should be placed at end of them.  However _cvs_files_removed is
} more problematic since it completes non-existing (but listed in
} CVS/Entries) files, though.

The following seems to give the desired behavior for the most part.  It
does partial-path completion as far as possible, then stops leaving the
trailing file name uncompleted.  Press TAB again, and it completes the
final part by examining the CVS/Entries file as usual.

There are actually only two hunks below that implement the behavior (the
last and the third-from-last).  The rest of the hunks remove explanation
strings from calls to _arguments or _alternative in cases where the called
action-function will eventually supply a more accurate one.  This prevents
messages that say e.g. "No matches for `file' or `removed file'" when in
fact only `removed file' was really attempted.  Are there other side-effects
of this that I've missed?

Index: Completion/Unix/Command/_cvs
===================================================================
--- Completion/Unix/Command/_cvs	2001/04/09 20:14:09	1.1.1.1
+++ Completion/Unix/Command/_cvs	2001/05/04 05:04:17
@@ -73,7 +73,7 @@
   _arguments -s \
     '-k+[keyword]:keyword substitution:_cvs_k' \
     '-m+[message]:message:_cvs_m' \
-    '*:file:_cvs_files_unmaintained' \
+    '*::_cvs_files_unmaintained' \
 }
 
 (( $+functions[_cvs_admin] )) ||
@@ -100,7 +100,7 @@
     '-t-[replace descriptive text]:descriptive text:_cvs_admin_t' \
     '-V+:version (obsolete):' \
     '-k+[set keyword substitution]:keyword substitution:_cvs_k' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_admin_t] )) ||
@@ -121,7 +121,7 @@
     '(-l)-R[recursive]' \
     '(-f -D)-r+[specify revision]:tag:_cvs_revisions' \
     '(-f -r)-D+[specify date]:date:_cvs_D' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_checkout] )) ||
@@ -157,7 +157,7 @@
     '(-F)-m+[message]:message:_cvs_m' \
     '(-m)-F+[message file]:log message file:_files' \
     '-r+[specify revision]:tag:_cvs_revisions' \
-    '*:file:_cvs_files_modified'
+    '*::_cvs_files_modified'
 }
 
 (( $+functions[_cvs_diff] )) ||
@@ -267,7 +267,7 @@
     '(--minimal)-d[try to find a smaller set of changes]' \
     '(-H)--speed-large-files[assume large files and many small changes]' \
     '(--speed-large-files)-H[assume large files and many small changes]' \
-    '*:file:_cvs_diff_arg'
+    '*::_cvs_diff_arg'
 }
 
 (( $+functions[_cvs_diff_arg] )) ||
@@ -282,7 +282,7 @@
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
     '-a+[specify action]:action:(edit unedit commit all none)' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_editors] )) ||
@@ -291,7 +291,7 @@
   _arguments -s \
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_export] )) ||
@@ -323,7 +323,7 @@
     '-w[working directory]' \
     '-D+[since date]:date:_cvs_D' \
     '-b+[back to record]:string:' \
-    '-f+[specify file]:file:_cvs_files' \
+    '-f+[specify file]::_cvs_files' \
     '-m+[specify module]:module:_cvs_modules' \
     '*-n+[in module]:module:_cvs_modules' \
     '*-p+[in repository]:repository:' \
@@ -333,7 +333,7 @@
     '-x+[specify type]:type:_cvs_history_x' \
     '-X+[debugging]:arg:' \
     '-z+[specify timezone]:timezone:' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_history_x] )) ||
@@ -386,7 +386,7 @@
     '-r-[specify revisions]:revisions:' \
     '-s+[specify states]:states:(Exp Stab Rel dead)' \
     '-w-[specify logins]:logins:' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_login] )) ||
@@ -434,7 +434,7 @@
     '-f[force to remove]' \
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
-    '*:file:_cvs_remove_arg'
+    '*:removed file:_cvs_remove_arg'
 }
 
 (( $+functions[_cvs_remove_arg] )) ||
@@ -471,7 +471,7 @@
     '-v[verbose]' \
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_tag] )) ||
@@ -488,7 +488,7 @@
     '-r+[specify revision]:tag:_cvs_revisions' \
     '-D+[specify date]:date:_cvs_D' \
     ':tag:' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_unedit] )) ||
@@ -497,7 +497,7 @@
   _arguments -s \
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_update] )) ||
@@ -515,10 +515,10 @@
     '-k+[keyword]:keyword substitution:_cvs_k' \
     '(-D)-r+[specify revision]:tag:_cvs_revisions' \
     '(-r)-D+[specify date]:date:_cvs_D' \
-    '-j+[merge]:tag:_cvs_revisions' \
-    '*-I+[ignore files]:name:_files' \
+    '-j+[merge]::_cvs_revisions' \
+    '*-I+[ignore files]::_files' \
     '*-W+[wrapper specification]:spec:_files' \
-    '*:file:_cvs_files'
+    '*::_cvs_files'
 }
 
 (( $+functions[_cvs_watch] )) ||
@@ -534,7 +534,7 @@
 	    '(-R)-l[don'\''t recursive]' \
 	    '(-l)-R[recursive]' \
 	    ':watch command:' \
-	    '*:file:_cvs_files'
+	    '*::_cvs_files'
 	;;
       add|remove) # "+lRa:"
 	_arguments -s \
@@ -542,7 +542,7 @@
 	    '(-l)-R[recursive]' \
 	    '*-a+[specify action]:action:(edit unedit commit all none)' \
 	    ':watch command:' \
-	    '*:file:_cvs_files'
+	    '*::_cvs_files'
 	;;
     esac
   fi
@@ -554,7 +554,7 @@
   _arguments -s \
       '(-R)-l[don'\''t recursive]' \
       '(-l)-R[recursive]' \
-      '*:file:_cvs_files'
+      '*::_cvs_files'
 }
 
 (( $+functions[_cvs_version] )) ||
@@ -826,24 +826,24 @@
 (( $+functions[_cvs_files] )) ||
 _cvs_files () {
   _alternative \
-    'directories:directory:_cvs_existing_directories' \
-    'existing-files:file:_cvs_existing_entries' \
-    'removed-files:removed file:_cvs_nonexisting_entries'
+    'directories::_cvs_existing_directories' \
+    'existing-files::_cvs_existing_entries' \
+    'removed-files::_cvs_nonexisting_entries'
 }
 
 (( $+functions[_cvs_files_modified] )) ||
 _cvs_files_modified () {
   _alternative \
-    'directories:directory:_cvs_existing_directories' \
-    'existing-files:file:_cvs_modified_entries' \
-    'removed-files:removed file:_cvs_nonexisting_entries'
+    'directories::_cvs_existing_directories' \
+    'existing-files::_cvs_modified_entries' \
+    'removed-files::_cvs_nonexisting_entries'
 }
 
 (( $+functions[_cvs_files_removed] )) ||
 _cvs_files_removed () {
   _alternative \
-    'directories:directory:_cvs_existing_directories' \
-    'removed-files:removed file:_cvs_nonexisting_entries'
+    'directories::_cvs_existing_directories' \
+    'removed-files::_cvs_nonexisting_entries'
 }
 
 (( $+functions[_cvs_files_unmaintained] )) ||
@@ -856,7 +856,8 @@
 (( $+functions[_cvs_existing_directories] )) ||
 _cvs_existing_directories () {
   local expl
-  _wanted files expl file _path_files -g "*~(*/|)CVS(/)"
+  _wanted directories expl directory _path_files -g "*~(*/|)CVS(/)" ||
+  _cvs_path_prefixes
 }
 
 (( $+functions[_cvs_existing_entries] )) ||
@@ -881,7 +882,7 @@
     realdir=${(e)~linedir}
     [[ -f "$realdir"CVS/Entries ]] &&
     [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
-    _wanted files expl file _path_files -g "$pat"
+    _wanted files expl 'modified file' _path_files -g "$pat"
   else
     _cvs_existing_entries
   fi
@@ -945,7 +946,21 @@
       ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
     )
     compquote files
-    _wanted files expl file compadd -Qp "$linedir" -a files
+    _wanted files expl 'nonexistent file' compadd -Qp "$linedir" -a files
+  }
+}
+
+(( $+functions[_cvs_path_prefixes] )) ||
+_cvs_path_prefixes () {
+  local expl match
+  match=()
+  : ${PREFIX:#(#b)(*)(/[^/]#)}
+  [[ -n "$match[1]" ]] && {
+    PREFIX="$match[1]"
+    ISUFFIX="$match[2]$SUFFIX$ISUFFIX"
+    SUFFIX=''
+    _wanted directories expl directory \
+	_path_files -g "*~($PREFIX|(*/|)CVS)(/)" -S ''
   }
 }
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: cvs completion does not support partial path completion
  2001-05-04  5:16           ` PATCH: " Bart Schaefer
@ 2001-05-04 16:26             ` Bart Schaefer
  2001-05-07  7:58               ` Sven Wischnowsky
  2001-05-04 16:39             ` Bart Schaefer
  1 sibling, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2001-05-04 16:26 UTC (permalink / raw)
  To: zsh-workers

On May 4,  5:16am, Bart Schaefer wrote:
} Subject: PATCH: Re: cvs completion does not support partial path completio
}
} The rest of the hunks remove explanation strings from calls to
} _arguments or _alternative in cases where the called action-function
} will eventually supply a more accurate one. This prevents messages
} that say e.g. "No matches for `file' or `removed file'" when in fact
} only `removed file' was really attempted. Are there other side-effects
} of this that I've missed?

Yes, there were.  `*::_cvs_files' is interpreted as `*::_cvs_files: '
which of course will never do.  Is there _any_ way to specify an empty
message with the `*:...' form of _arguments spec?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: cvs completion does not support partial path completion
  2001-05-04  5:16           ` PATCH: " Bart Schaefer
  2001-05-04 16:26             ` Bart Schaefer
@ 2001-05-04 16:39             ` Bart Schaefer
  1 sibling, 0 replies; 14+ messages in thread
From: Bart Schaefer @ 2001-05-04 16:39 UTC (permalink / raw)
  To: zsh-workers

On May 4,  5:16am, Bart Schaefer wrote:
} Subject: PATCH: Re: cvs completion does not support partial path completio
}
} The following seems to give the desired behavior for the most part.  It
} does partial-path completion as far as possible, then stops leaving the
} trailing file name uncompleted.  Press TAB again, and it completes the
} final part by examining the CVS/Entries file as usual.

Here's the patch as I actually plan to commit it.  In addition to the
problem with the empty message-part of the _arguments spec, I found that
it didn't complete properly in the middle of a word.

Index: Completion/Unix/Command/_cvs
===================================================================
--- Completion/Unix/Command/_cvs	2001/04/09 20:14:09	1.1.1.1
+++ Completion/Unix/Command/_cvs	2001/05/04 16:33:59
@@ -73,7 +73,7 @@
   _arguments -s \
     '-k+[keyword]:keyword substitution:_cvs_k' \
     '-m+[message]:message:_cvs_m' \
-    '*:file:_cvs_files_unmaintained' \
+    '*:added file:_cvs_files_unmaintained' \
 }
 
 (( $+functions[_cvs_admin] )) ||
@@ -157,7 +157,7 @@
     '(-F)-m+[message]:message:_cvs_m' \
     '(-m)-F+[message file]:log message file:_files' \
     '-r+[specify revision]:tag:_cvs_revisions' \
-    '*:file:_cvs_files_modified'
+    '*:modified file:_cvs_files_modified'
 }
 
 (( $+functions[_cvs_diff] )) ||
@@ -434,7 +434,7 @@
     '-f[force to remove]' \
     '(-R)-l[don'\''t recursive]' \
     '(-l)-R[recursive]' \
-    '*:file:_cvs_remove_arg'
+    '*:removed file:_cvs_remove_arg'
 }
 
 (( $+functions[_cvs_remove_arg] )) ||
@@ -516,7 +516,7 @@
     '(-D)-r+[specify revision]:tag:_cvs_revisions' \
     '(-r)-D+[specify date]:date:_cvs_D' \
     '-j+[merge]:tag:_cvs_revisions' \
-    '*-I+[ignore files]:name:_files' \
+    '*-I+[ignore files]:file:_files' \
     '*-W+[wrapper specification]:spec:_files' \
     '*:file:_cvs_files'
 }
@@ -856,7 +856,8 @@
 (( $+functions[_cvs_existing_directories] )) ||
 _cvs_existing_directories () {
   local expl
-  _wanted files expl file _path_files -g "*~(*/|)CVS(/)"
+  _wanted directories expl directory _path_files -g "*~(*/|)CVS(/)" ||
+  _cvs_path_prefixes
 }
 
 (( $+functions[_cvs_existing_entries] )) ||
@@ -881,7 +882,7 @@
     realdir=${(e)~linedir}
     [[ -f "$realdir"CVS/Entries ]] &&
     [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
-    _wanted files expl file _path_files -g "$pat"
+    _wanted files expl 'modified file' _path_files -g "$pat"
   else
     _cvs_existing_entries
   fi
@@ -945,7 +946,20 @@
       ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
     )
     compquote files
-    _wanted files expl file compadd -Qp "$linedir" -a files
+    _wanted files expl 'removed file' compadd -Qp "$linedir" -a files
+  }
+}
+
+(( $+functions[_cvs_path_prefixes] )) ||
+_cvs_path_prefixes () {
+  local expl match
+  match=()
+  [[ "$PREFIX$SUFFIX" = (#b)(*)(/[^/]#) ]] && {
+    PREFIX="$match[1]"
+    ISUFFIX="$match[2]$ISUFFIX"
+    SUFFIX=''
+    _wanted directories expl directory \
+	_path_files -g "*~($PREFIX|(*/|)CVS)(/)" -S ''
   }
 }
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: cvs completion does not support partial path completion
  2001-05-04 16:26             ` Bart Schaefer
@ 2001-05-07  7:58               ` Sven Wischnowsky
  2001-05-07 14:52                 ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: Sven Wischnowsky @ 2001-05-07  7:58 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> Yes, there were.  `*::_cvs_files' is interpreted as `*::_cvs_files: '
> which of course will never do.  Is there _any_ way to specify an empty
> message with the `*:...' form of _arguments spec?

I normally use a sigle space, but that still results in a `-X desc'
option passed to the action.  If you don't want that, we could probably
special-case that single space to mean to not pass a -X.

Bye
  Sven


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: cvs completion does not support partial path completion
  2001-05-07  7:58               ` Sven Wischnowsky
@ 2001-05-07 14:52                 ` Bart Schaefer
  2001-05-08  8:45                   ` Sven Wischnowsky
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2001-05-07 14:52 UTC (permalink / raw)
  To: zsh-workers

On May 7,  9:58am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: Re: cvs completion does not support partial path compl
}
} Bart Schaefer wrote:
} 
} > Yes, there were.  `*::_cvs_files' is interpreted as `*::_cvs_files: '
} > which of course will never do.  Is there _any_ way to specify an empty
} > message with the `*:...' form of _arguments spec?
} 
} I normally use a sigle space, but that still results in a `-X desc'
} option passed to the action.

Yes, which results in things like

    No match for ` ', `file', or `directory'

} If you don't want that, we could probably special-case that single space
} to mean to not pass a -X.

Either that, or strip all leading/trailing whitespace from the message,
and ignore empty messages.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: cvs completion does not support partial path completion
  2001-05-07 14:52                 ` Bart Schaefer
@ 2001-05-08  8:45                   ` Sven Wischnowsky
  0 siblings, 0 replies; 14+ messages in thread
From: Sven Wischnowsky @ 2001-05-08  8:45 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> ...
> 
> } If you don't want that, we could probably special-case that single space
> } to mean to not pass a -X.
> 
> Either that, or strip all leading/trailing whitespace from the message,
> and ignore empty messages.

Yes, that's better.


Bye
  Sven

Index: Completion/Base/Core/_description
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_description,v
retrieving revision 1.1
diff -u -r1.1 _description
--- Completion/Base/Core/_description	2001/04/02 11:03:01	1.1
+++ Completion/Base/Core/_description	2001/05/08 08:44:49
@@ -9,7 +9,8 @@
   shift
 fi
 
-_lastdescr=( "$_lastdescr[@]" "$3" )
+3="${${3##[[:blank:]]#}%%[[:blank:]]#}"
+[[ -n "$3" ]] && _lastdescr=( "$_lastdescr[@]" "$3" )
 
 zstyle -s ":completion:${curcontext}:$1" group-name gname &&
     [[ -z "$gname" ]] && gname="$1"
@@ -51,7 +52,11 @@
 fi
 
 shift 2
-[[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+if [[ -z "$1" && $# -eq 1 ]]; then
+  format=
+elif [[ -n "$format" ]]; then
+  zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+fi
 
 if [[ -n "$gname" ]]; then
   if [[ -n "$format" ]]; then
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.121
diff -u -r1.121 compsys.yo
--- Doc/Zsh/compsys.yo	2001/04/27 09:12:34	1.121
+++ Doc/Zsh/compsys.yo	2001/05/08 08:44:52
@@ -2879,7 +2879,9 @@
 This describes the var(n)'th normal argument.  The var(message) will be 
 printed above the matches generated and the var(action) says what can
 be completed in this position (see below).  If there are two colons
-before the var(message), this describes an optional argument.
+before the var(message), this describes an optional argument.  If the
+var(message) contains only white space, nothing will be printed above
+the matches unless the action adds an explanation string itself.
 )
 xitem(tt(:)var(message)tt(:)var(action))
 item(tt(::)var(message)tt(:)var(action))(
@@ -3008,7 +3010,8 @@
 item(tt(::)var(message)tt(:)var(action))(
 Describes a mandatory argument with one colon, or an optional argument
 with two colons.  As in other forms of var(spec), the var(message) will be
-printed above the matches generated and the var(action) says what can be
+printed above the matches generated (unless it contains only white
+space, see above) and the var(action) says what can be
 completed in this position.
 )
 xitem(tt(:*)var(pattern)tt(:)var(message)tt(:)var(action))
@@ -3460,7 +3463,11 @@
 
 The string returned by the tt(format) style (if any) will be modified so
 that the sequence `tt(%d)' is replaced by the var(descr) given as the third
-argument.  If tt(_description) is called with more than three arguments,
+argument without any leading or trailing white space.  If, after
+removing the white space, the var(descr) is the empty string, the format
+style will not be used and the options put into the var(name) array will
+not contain an explantion string to be displayed above the matches.If
+tt(_description) is called with more than three arguments,
 the additional var(specs) should be of the form `var(char)tt(:)var(str)'
 and every appearance of `tt(%)var(char)' in the format string will be
 replaced by var(string).

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2001-05-08  8:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-26 14:05 cvs completion does not support partial path completion Andrej Borsenkow
2001-04-27 12:20 ` Sven Wischnowsky
2001-04-27 13:08   ` Andrej Borsenkow
2001-04-27 13:22     ` Sven Wischnowsky
2001-04-27 17:54   ` Bart Schaefer
2001-04-30  8:17     ` Sven Wischnowsky
2001-04-30 16:56       ` Bart Schaefer
2001-05-01  9:39         ` Tanaka Akira
2001-05-04  5:16           ` PATCH: " Bart Schaefer
2001-05-04 16:26             ` Bart Schaefer
2001-05-07  7:58               ` Sven Wischnowsky
2001-05-07 14:52                 ` Bart Schaefer
2001-05-08  8:45                   ` Sven Wischnowsky
2001-05-04 16:39             ` 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).