zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk
Subject: Re: The (e) glob qualifier and NO_NOMATCH
Date: Thu, 22 Jun 2006 16:12:22 +0200	[thread overview]
Message-ID: <3849.1150985542@dcle12> (raw)
In-Reply-To: <060621064945.ZM17820@torch.brasslantern.com>

Bart wrote:
> 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*".

The main thing that makes (e) useful is that it runs the function once
for each matched file. forcemount presumably is something that only
needs to run once because the parameter you want to pass is an
unexpanded pattern.

Given that you can do something like:

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

is your point purely that you think the syntax would be nice or are you
thinking in terms of being able to pass the function down through the
completion system so that it is only run if and when _path_files expands
the pattern?

> don't seem to have the order-dependence that one might expect:
> 
>   print *(e:'reply=(${REPLY}x)':/)

In many respects using (e) and modifying $reply makes it more of a
modifier than a qualifier. Perhaps we should have had a :e modifier.

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

You might also find it interesting to look at the trick I used in
_subversion for tricking globbing into generating files that don't
exist. It does the following:

  _files -g ".svn(/e:_svn_deletedfiles:)"

The use of .svn as the file is largely irrelevant. This works better
than the similar functionality in _cvs because the rest of
_file/_path_files is used). It isn't perfect due to the fact that the
fake files can't have type information associated with them.

Oliver


  reply	other threads:[~2006-06-22 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 13:49 Bart Schaefer
2006-06-22 14:12 ` Oliver Kiddle [this message]
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=3849.1150985542@dcle12 \
    --to=okiddle@yahoo.co.uk \
    --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).