Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Question about Completion



On Thu, Oct 11 2001, Felix Rosencrantz wrote:

Hi,

> I received some private replies from Goran and Sven about Clearcase filename
> completion back in Sept that I thought I would forward in part to the list. (I
> figure there might be a few lurkers who have some interest.)
> 
> On Sep 23 23:54:17 2001, Goran Koruga wrote:
> >Someone else has told me to use setopt automenu and setopt autolist.
> >This works if I don't have my custom completion module - so later on I
> >asked if there's a way to get that working.
> 
> Check Sven's reply below...

Will do so and experiment with it when I find the time for it.

> >Right now I am still banging my head with the first problem - it will
> >call _cc_files and _cc_co_files even when just arguments are to be
> >completed. I have realized that _arguments has -A switch, but that will
> >mean I have to change all calls to _arguments to add -A "-*" (I have
> >actually found that in one of the man pages ;). I have checked _cvs
> >script and it seems quite similar to mine, however for them the file
> >completing functions are not called.
> 
> Not sure.  It might be useful to look at the trace output to see what is
> happening.  If you use the default bindings, there is a nice completion trace
> facility via "^X-?".
> 
> >All of this completion stuff is quite complex. Right now I will try to
> >compare CVS completion against mine to try and figure out the difference.
> 
> One problem I noticed with your completion function is that you use the "-s"
> flag with _arguments.  This is used if you have single letter options that can
> be combined into a single word (e.g. the ls command allows "ls -la"). 
> Clearcase has word options, not letter options, so doesn't need this flag like
> cvs does.

Hmm looks like I have overlooked this one. I have removed it and didn't
notice anything strange.

> In response to a message where I mention some comments Sven had made some time
> back in zsh-workers #9631.  He makes a another possible to _path_files.  (I
> don't have access to clearcase, so I can't test this...)
> 
> On Tue Sep 25 05:33:12 2001, Sven Wischnowsky responded.
> >From Sven Wischnowsky Tue Sep 25 05:33:12 2001
> >I don't remember what I suggested back then and don't have the time to
> >look it up now.  But anyway, Goran and others using ClearCase who want
> >to help could try the following: make themselves a copy of _path_files
> >and insert before line 36 something like:
> >
> >  if compset -P '*@@'; then
> >    # code to complete the version string here...
> >    return
> >  fi
> >
> >Instead of that `fi' one could try:
> >
> >  elif (( ! $pfxsfx[(I)-[a-zA-Z12]S] )); then
> >    pfxsfx=( "$pfxsfx[@]" -qS '@@' )
> >  fi
> >
> >To make it always add an automatically removable `@@' suffix if there
> >isn't one from the calling function.
> >
> >Then if we arrive at something usable, we can start thinking about how
> >to integrate that into the distribution, maybe with one or more styles
> >or by adding generic code into _path_files so that can make it call
> >arbitrary helper functions (with one for ClearCase being the first
> >implemented) or whatever.

This is definitely a good tip. I will look into this. Thanks.

I have some more questions regarding my completion attempt : my
completions don't get coloured. Where should I look to fix that ? It
would also be nice to cache completions, but that is way beyond me right
now. And is the only way to prevent calling _cc_files by using -A "-*"
arguments to _arguments function ?

Thanks for assistance.

> 
> -FR.
> 
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com
> 

Best regards,
Goran

--

Writing about music is like dancing about architecture.
    -- Frank Zappa 



Messages sorted by: Reverse Date, Date, Thread, Author