zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: The (e) glob qualifier and NO_NOMATCH
Date: Wed, 21 Jun 2006 06:49:43 -0700	[thread overview]
Message-ID: <060621064945.ZM17820@torch.brasslantern.com> (raw)

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.

-- 


             reply	other threads:[~2006-06-21 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 13:49 Bart Schaefer [this message]
2006-06-22 14:12 ` Oliver Kiddle
2006-06-22 16:51   ` Bart Schaefer
2006-06-23  9:53     ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=060621064945.ZM17820@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).