zsh-workers
 help / color / mirror / code / Atom feed
* file-patterns problem
@ 2000-02-23 18:57 Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2000-02-23 18:57 UTC (permalink / raw)
  To: Zsh hackers list

I'm sure there are going to be more ramifications of the user guide chapter
on completion (indeed, I've got a file of remarks which I'll need to
reprocess), but here's something that arose because Bart didn't like the
way I'd described file-patterns (thanks to Bart and Sven for some
corrections etc.).  The description now looks like this:

  It was explained above for the tag-order style that when a function
  uses pattern matching to generate file completions, such as all *.ps
  files or all *.gz files, the three tags globbed-files,
  all-files and directories are tried.  When you set something with
  file-patterns, all three tags are automatically activated.  So, for
  example, after

    zstyle ':completion:*:*:foo:*:*' file-patterns '*.yo'

  the command named `foo' will complete files ending in `.yo', as
  well as directories.   For once, you don't have to change the completer to
  do this:  `foo' isn't specially handled, so does default completion,
  and that means completing files, so that file-patterns is active
  anyway.

  You can now set up your tag-order style to include
  globbed-patterns, which represents the `.yo' files, and
  directories and all-files; suppose you want to make the `.yo'
  files and the directories appear at the same time:

    zstyle ':completion:*:*:foo:*:*' tag-order 'directories globbed-files'

Unfortunately this doesn't seem to work --- I don't get the directories,
even if there aren't any .yo files.  I can't see what's going wrong.  I can
add `*(-/)' to the globbed files list, of course, but then they're
naturally regarded as attached to the globbed-files tag.  Maybe I've got
the wrong end of the stick somewhere.


The other issue, with the position of the `predict' in its context, has
just been sorted out.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


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

* RE: file-patterns problem
@ 2000-02-24 10:19 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-02-24 10:19 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> ...
> 
> In other words - setting styles for partucular tag has a side effect of
> enabling this tag? I find it really confusing. Do not we have special tag to
> enable/disable tags (ough :-) Hmm looks, like not. The closest is
> tag-order - and if it gets slightly different name (without so much strngth
> on ``order'') - it is quite usable to say, which tags and in which order.
> 
> In the case above - files and path_files should have default tags to try and
> with default patterns. If you do not want to see all files - set tag-order
> to the correct tags. If you wnat other patterns - set file-patterbs. If you
> want only particular tags with particular patterns - set both.

The problem is that user may, quite sensibly, set a global value for
tag-order to something like:

  zstyle ':completion:*' tag-order globbed-files directories all-files ...

With that every filename completion would use all three tags. it will
often be possible to ignore globbed-files (we are talking only about
cases where _files is called without an explicit -g) when there is no
corresponding file-patterns style. But it would make directories be
preferred in every filename completion -- so it would have just a
different kind of side-effect.

Because of that I still prefer the way we do it now, as long as we get 
sorted out how the directories flag should be used. Which mainly
means: always if a file-pattern for globebd-files is set or not.

Bye
 Sven


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


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

* RE: file-patterns problem
  2000-02-24  9:04 Sven Wischnowsky
@ 2000-02-24  9:49 ` Andrej Borsenkow
  0 siblings, 0 replies; 4+ messages in thread
From: Andrej Borsenkow @ 2000-02-24  9:49 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> First of all: if one wants to set a file-pattern explicitly one should
> use the tag one wants to set it for. Otherwise it will always be used,
> for all possible tags.
>
> Second: one only gets the extra (i.e. normally not tried) tags one
> explicitly selects. So:
>
>   zstyle ':completion:*:*:foo:*:globbed-files' file-patterns '*.yo'
>
> Makes only the globbed-files and the all-files tags be used. If one
> wants directories, one has to say that:
>
>   zstyle ':completion:*:*:foo:*:directories' file-patterns '*(-/)'
>
> This is a bit ugly. I /think/ I asked if we should make this different
> when I added the file-patterns style, but it may well be that I
> forgot. So: should we make the directories tag with its usual pattern
> be tried automatically if the user explicitly sets the file-patterns
> tag for globbed-files? Or should we do that only if the directories tag,
> file-patterns style is given, but allow an empty value to stand for
> `the normal pattern'?
>

In other words - setting styles for partucular tag has a side effect of
enabling this tag? I find it really confusing. Do not we have special tag to
enable/disable tags (ough :-) Hmm looks, like not. The closest is
tag-order - and if it gets slightly different name (without so much strngth
on ``order'') - it is quite usable to say, which tags and in which order.

In the case above - files and path_files should have default tags to try and
with default patterns. If you do not want to see all files - set tag-order
to the correct tags. If you wnat other patterns - set file-patterbs. If you
want only particular tags with particular patterns - set both.

/andrej


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

* Re: file-patterns problem
@ 2000-02-24  9:04 Sven Wischnowsky
  2000-02-24  9:49 ` Andrej Borsenkow
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-02-24  9:04 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> I'm sure there are going to be more ramifications of the user guide chapter
> on completion (indeed, I've got a file of remarks which I'll need to
> reprocess), but here's something that arose because Bart didn't like the
> way I'd described file-patterns (thanks to Bart and Sven for some
> corrections etc.).  The description now looks like this:
> 
>   It was explained above for the tag-order style that when a function
>   uses pattern matching to generate file completions, such as all *.ps
>   files or all *.gz files, the three tags globbed-files,
>   all-files and directories are tried.  When you set something with
>   file-patterns, all three tags are automatically activated.  So, for
>   example, after
> 
>     zstyle ':completion:*:*:foo:*:*' file-patterns '*.yo'
> 
>   the command named `foo' will complete files ending in `.yo', as
>   well as directories.   For once, you don't have to change the completer to
>   do this:  `foo' isn't specially handled, so does default completion,
>   and that means completing files, so that file-patterns is active
>   anyway.
> 
>   You can now set up your tag-order style to include
>   globbed-patterns, which represents the `.yo' files, and
>   directories and all-files; suppose you want to make the `.yo'
>   files and the directories appear at the same time:
> 
>     zstyle ':completion:*:*:foo:*:*' tag-order 'directories globbed-files'
> 
> Unfortunately this doesn't seem to work --- I don't get the directories,
> even if there aren't any .yo files.  I can't see what's going wrong.  I can
> add `*(-/)' to the globbed files list, of course, but then they're
> naturally regarded as attached to the globbed-files tag.  Maybe I've got
> the wrong end of the stick somewhere.

First of all: if one wants to set a file-pattern explicitly one should 
use the tag one wants to set it for. Otherwise it will always be used, 
for all possible tags.

Second: one only gets the extra (i.e. normally not tried) tags one
explicitly selects. So:

  zstyle ':completion:*:*:foo:*:globbed-files' file-patterns '*.yo'

Makes only the globbed-files and the all-files tags be used. If one
wants directories, one has to say that:

  zstyle ':completion:*:*:foo:*:directories' file-patterns '*(-/)'

This is a bit ugly. I /think/ I asked if we should make this different 
when I added the file-patterns style, but it may well be that I
forgot. So: should we make the directories tag with its usual pattern
be tried automatically if the user explicitly sets the file-patterns
tag for globbed-files? Or should we do that only if the directories tag,
file-patterns style is given, but allow an empty value to stand for
`the normal pattern'?

Bye
 Sven


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


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

end of thread, other threads:[~2000-02-24 10:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-23 18:57 file-patterns problem Peter Stephenson
2000-02-24  9:04 Sven Wischnowsky
2000-02-24  9:49 ` Andrej Borsenkow
2000-02-24 10:19 Sven Wischnowsky

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).