zsh-workers
 help / color / mirror / code / Atom feed
* The (e) glob qualifier and NO_NOMATCH
@ 2006-06-21 13:49 Bart Schaefer
  2006-06-22 14:12 ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2006-06-21 13:49 UTC (permalink / raw)
  To: zsh-workers

It occurs to me that, unlike most of the other glob qualifiers, (e:cmd:)
doesn't necessarily need any existing filename on which to operate.

Consider by comparison _path_files in the completion code, which includes
a hack to force auto-mounting.  Wouldn't it be nice to be able to write a
function "forcemount" that matches a pattern against /etc/hosts or NIS
and mounts all those filesystems?  Then you could use

  for remote in /net/r*(+forcemount); do ...

This currently doesn't work, because once "r*" fails to match anything
in /net, the qualifiers are ignored and the entire string is returned as
the result.  Instead we'd need to call "forcemount" with REPLY set to
the path segment pattern "r*".

Unfortunately it looks like this would need a pretty large reworking of
the globbing code.  The original source string of path segment patterns
isn't kept around anywhere that I immediately see, and NO_NOMATCH is
handled only after the entire scan has completed.  Further, qualifiers
don't seem to have the order-dependence that one might expect:

  print *(e:'reply=(${REPLY}x)':/)

first finds all directories and then appends "x" to their names, rather
than failing entirely because there are no directories having the names
that result after appending an x to an existing name, and

  print *(e:'reply=(${REPLY}x)':e:'reply=(${REPLY}y)':)

does not produce names with "xy" appended, only with "y".

For the time being, I guess this is just food for thought.

-- 


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

end of thread, other threads:[~2006-06-23  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-21 13:49 The (e) glob qualifier and NO_NOMATCH Bart Schaefer
2006-06-22 14:12 ` Oliver Kiddle
2006-06-22 16:51   ` Bart Schaefer
2006-06-23  9:53     ` Oliver Kiddle

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