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

Re: change to __path_files and clean up of Functions/Completion needed



Andrej Borsenkow wrote:

> # This function behaves as if you have a matcher definition like:
> #   compctl -M 'r:|[-.,_/]=* r:|=* m:{a-z}={A-Z} m:-=_ m:.=,' \
> #              'm:{a-z}={A-Z} l:|=* r:|=*'
> # so you may want to modify this.
> 
> I think, it is unacceptable. It is the same, as if users had to modify C
> sources to change compctl behaviour.

I don't think so. This is shell code after all. I agree, though, that
we draw more attention to this -- I added the comment for this but I
know that this may be not enough. This function was initially written
to show some of the nice things that can be done with the new
completion stuff.

> I'd suggest, that __path_files would
> take -M argument to do the same.

Functions like `_path_files' do all the the matching themselves. If we
make them get only a `-M ...' argument, the function would have to
parse it and derive a set of `:gs/.../.../' modifiers from it. This
can get so hard, I don't even want to think about implementing it. But 
I just had another idea: add two autoloaded functions: `_match_test'
and `_match_pattern' or something like that. Functions like
`_path_files' would call the first one at the beginning:

  _match_test || return

This function would test the value of `MATCHER' to see if the calling
function should try to build matches, the standard implementation
would be:

  (( MATCHER == 1 ))

The function `_match_pattern' would be called with the name of a
parameter. It's duty is to modify the value of this parameter so that
it contains the pattern to use for matching. The standard
implementation would be an empty function.

That way the user can supply for the match-specs he uses (more
precisely: for the match specs he wants to use in such functions) by
simply writing files into a directory that is searched before the
standard directory.

As a reply to your other mail: yes, maybe we should already start
splitting the contents of the directory. Currently this was intended
as a repository from which users might copy the files they want into
some other directory.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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