zsh-workers
 help / color / mirror / code / Atom feed
* More fun with completion: glob qualifiers ignored for ignored-patterns style?
@ 2003-07-14 20:33 Philippe Troin
  2003-07-14 21:39 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Troin @ 2003-07-14 20:33 UTC (permalink / raw)
  To: zsh-workers

% echo $ZSH_VERSION 
4.0.7
% ls
% touch file
% mkdir dir
% ls
dir/  file
% zstyle ':completion:*:all-files' ignored-patterns '*(/)'
% ls <TAB>
>>> Completing files...
dir/   file 

"dir" should not have been a completion candidate...

% zstyle ':completion:*:all-files' ignored-patterns '*(e:''[[ -d $REPLY ]]'')'
% ls <TAB>
>>> Completing files...
dir/   file 

Nor here (note: I use setopt rcquotes).

% zstyle ':completion:*:all-files' ignored-patterns '(#b)file(#e)'
% ls <TAB>
% ls dir/

Is that because bare_glob_qual is unset when expanding the pattern?

By the way, the manual says about glob qualifiers:

   Patterns used for filename generation may end in a list of qualifiers
   enclosed in parentheses.  The qualifiers specify which filenames that
   otherwise match the given pattern will be inserted in the argument list.

   If the option BARE_GLOB_QUAL is set, then a trailing set of parentheses
   containing no `|' or `(' characters (or `~' if it is special) is taken
   as a set of glob qualifiers.  A glob subexpression that would normally
   be taken as glob qualifiers, for example `(^x)', can be forced to be
   treated as part of the glob pattern by doubling the parentheses, in
   this case producing `((^x))'.

Does that mean that:

 - if BARE_GLOB_QUAL is set, glob qualifiers are enabled

 - if BARE_GLOB_QUAL is unset, glob qualifiers are disabled?

The behavior of zsh when BARE_GLOB_QUAL is unset is very unclear from
the above description, at least for me...

Phil.


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

* Re: More fun with completion: glob qualifiers ignored for ignored-patterns style?
  2003-07-14 20:33 More fun with completion: glob qualifiers ignored for ignored-patterns style? Philippe Troin
@ 2003-07-14 21:39 ` Bart Schaefer
  2003-07-15  1:57   ` Philippe Troin
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2003-07-14 21:39 UTC (permalink / raw)
  To: zsh-workers

On Jul 14,  1:33pm, Philippe Troin wrote:
} Subject: More fun with completion: glob qualifiers ignored for ignored-pat
}
} % zstyle ':completion:*:all-files' ignored-patterns '*(/)'

The ignored-patterns style is not checked for the all-files tag, only for
the globbed-files tag in _files and the argument-rest tag in _normal.

However, even if you set it for the correct tag, it still won't work,
because it really is a _pattern_ (as in [[ string = pattern ]]) and not
a filesystem glob.  It can only match the string, not the file type.

} Is that because bare_glob_qual is unset when expanding the pattern?

So, no.

} By the way, the manual says about glob qualifiers:
} 
}    If the option BARE_GLOB_QUAL is set, then a trailing set of parentheses
}    containing no `|' or `(' characters (or `~' if it is special) is taken
}    as a set of glob qualifiers.
} 
} Does that mean that:
} 
}  - if BARE_GLOB_QUAL is set, glob qualifiers are enabled
} 
}  - if BARE_GLOB_QUAL is unset, glob qualifiers are disabled?

In 4.0.x, that's effectively what it means.  BARE_GLOB_QUAL was added in
anticipation of other qualifier syntax that had not been invented yet.

In 4.1.x, it means that if BARE_GLOB_QUAL is set, zsh uses a heuristic to
decide if a trailing parenthesized expression is a glob qualifier, and if
BARE_GLOB_QUAL is NOT set, you have to 'setopt EXTENDED_GLOB' and use an
explicit (#q) to introduce a qualifier.


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

* Re: More fun with completion: glob qualifiers ignored for ignored-patterns style?
  2003-07-14 21:39 ` Bart Schaefer
@ 2003-07-15  1:57   ` Philippe Troin
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Troin @ 2003-07-15  1:57 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer <schaefer@brasslantern.com> writes:

> On Jul 14,  1:33pm, Philippe Troin wrote:
> } Subject: More fun with completion: glob qualifiers ignored for ignored-pat
> }
> } % zstyle ':completion:*:all-files' ignored-patterns '*(/)'
> 
> The ignored-patterns style is not checked for the all-files tag, only for
> the globbed-files tag in _files and the argument-rest tag in _normal.
> 
> However, even if you set it for the correct tag, it still won't work,
> because it really is a _pattern_ (as in [[ string = pattern ]]) and not
> a filesystem glob.  It can only match the string, not the file type.

Ok, that makes sense.

> } Is that because bare_glob_qual is unset when expanding the pattern?
> 
> So, no.
> 
> } By the way, the manual says about glob qualifiers:
> } 
> }    If the option BARE_GLOB_QUAL is set, then a trailing set of parentheses
> }    containing no `|' or `(' characters (or `~' if it is special) is taken
> }    as a set of glob qualifiers.
> } 
> } Does that mean that:
> } 
> }  - if BARE_GLOB_QUAL is set, glob qualifiers are enabled
> } 
> }  - if BARE_GLOB_QUAL is unset, glob qualifiers are disabled?
> 
> In 4.0.x, that's effectively what it means.  BARE_GLOB_QUAL was added in
> anticipation of other qualifier syntax that had not been invented yet.
> 
> In 4.1.x, it means that if BARE_GLOB_QUAL is set, zsh uses a heuristic to
> decide if a trailing parenthesized expression is a glob qualifier, and if
> BARE_GLOB_QUAL is NOT set, you have to 'setopt EXTENDED_GLOB' and use an
> explicit (#q) to introduce a qualifier.

Understood. Then the 4.0.x manual is quite confusing in that respect,
at least to me.

Thanks.
Phil.


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

end of thread, other threads:[~2003-07-15  1:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-14 20:33 More fun with completion: glob qualifiers ignored for ignored-patterns style? Philippe Troin
2003-07-14 21:39 ` Bart Schaefer
2003-07-15  1:57   ` Philippe Troin

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