zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Adam Spiers <adam@spiers.net>, zsh-workers@sunsite.auc.dk
Subject: Re: _files vs _path_files discussion (old thread)
Date: Sun, 12 Mar 2000 19:43:32 +0000	[thread overview]
Message-ID: <1000312194332.ZM27890@candle.brasslantern.com> (raw)
In-Reply-To: <20000312130233.A4744@thelonious.new.ox.ac.uk>

On Mar 12,  1:02pm, Adam Spiers wrote:
} Subject: Re: _files vs _path_files discussion (old thread)
}
}    # Include non-hidden directories in globbed file completions
}    compstyle '::complete:*' \
}      tag-order 'globbed-files directories' all-files 
}    compstyle '::complete:*:*:directories' file-patterns '*~.*(-/)'
} 
} It's almost perfect ...

Have you tried that with, say, `ls' ?  I'll bet it ends up completing
_only_ directories, because there's no -g option passed to _files for
`ls' like there is for `tar'.

If you have global directories file-patterns you're going to need them
for globbed-files, too ... which then messes up things like `tar' that
pass patterns with -g.  The globbed-files style replaces the -g option
of _files.

} The only problem left is in the handling of
} hidden directories; ideally, I would want hidden directories only to
} appear when the leading `.' is specified manually

Hrm, the behavior you want is the behavior I get (for tar), by using:

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

Do you have the GLOB_DOTS option set, by chance?

}    zstyle ':completion::complete:*:*:directories' \
}      file-patterns '*(-/)'
}    zstyle ':completion::complete:*:*:unhidden-directories' \
}      file-patterns '*~.*(-/)'
}    zstyle ':completion::complete:*' tag-order \
}      'globbed-files unhidden-directories' \
}      'globbed-files directories' \
}      all-files
} 
} except that that doesn't work, presumably because you can't just dream
} up new tags like that

You can dream up new tags, but they'll only be used by functions that
know about them -- so you'd have to e.g. modify _files as well.

} and maybe you can't even mention tags twice in tag-order.

It doesn't make sense to mention tags twice in tag-order, because (in
your example) 'globbed-files directories' will only be used when there
are no completions for 'globbed-files unhidden-directories', which 
can't happen if there are any completions for globbed-files alone.

Effectively, what you want is to subdivide the 'directories' tag and
have it treated like it has it's own internal tag-order.  There isn't
any way I can think of to express that at the moment.

One possibility would be to make file-patterns itself into a hierarchy;
that is

zstyle :completion::complete:tar::directories \
	file-patterns '*(-/)' '.*(-/)'

would mean to use '.*(-/)' only if '*(-/)' returned nothing.  The current
meaning of the above is also expressible by

zstyle :completion::complete:tar::directories \
        file-patterns '*(-/) .*(-/)'

(that is, file-patterns is presently a string, not an array) so we would
not be losing any functionality.

Then all we need is a magic token in file-patterns to mean "use anything
passed to _files with the -g option here" and global file-patterns would
become really useful.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~2000-03-12 19:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-17  7:28 PATCH: _rpm tweaks (_files vs _path_files discussion) Sven Wischnowsky
2000-03-11 22:22 ` _files vs _path_files discussion (old thread) Adam Spiers
2000-03-12  0:18   ` Bart Schaefer
2000-03-12  0:51     ` Adam Spiers
2000-03-12  6:21       ` Bart Schaefer
2000-03-12  6:34         ` Bart Schaefer
2000-03-12 13:02 ` Adam Spiers
2000-03-12 19:43   ` Bart Schaefer [this message]
2000-03-12 20:14     ` Adam Spiers
2000-03-12 22:51       ` Bart Schaefer
2000-03-13 13:07 Sven Wischnowsky
2000-03-13 17:54 ` Bart Schaefer

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=1000312194332.ZM27890@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=adam@spiers.net \
    --cc=zsh-workers@sunsite.auc.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).