Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Tabcomplete autoloads zsh/stat [was: Re: File locking within zsh?]



On 5/12/06, Peter Stephenson <pws@xxxxxxx> wrote:
"Mikael Magnusson" <mikachu@xxxxxxxxx> wrote:
> One thing that has annoyed me recently is that 'stat <tab> autoloads
> zsh/stat without me asking for it, I never know which stat version is
> loaded and the options aren't compatible. Should I live with it and
> alias stat=command stat or is it a bug in the completer? If i have the
> alias and load the module manually i'll still use the command so it's
> still not a perfect solution.

The stat completion itself appears not to require zsh/stat, but it's used
elsewhere.  Quite possibly the culprit is my _list_files addition, which
loads the module even if you're not using the feature.  Does the following
help?  (CVS is unwell)

--- Completion/Unix/Type/_list_files.old        2006-05-12 10:40:39.000000000 +0100
+++ Completion/Unix/Type/_list_files    2006-05-12 10:40:34.000000000 +0100
@@ -15,8 +15,6 @@
 listfiles=()
 listopts=()

-zmodload -i zsh/stat 2>/dev/null || return 1
-
 zstyle -a ":completion:${curcontext}:" file-list stylevals || return 1

 # TODO: more flexible way of handling the following?  e.g. use $compstate?
@@ -48,6 +46,8 @@

 (( ok )) || return 1

+zmodload -i zsh/stat 2>/dev/null || return 1
+
 for f in ${(P)1}; do
   if [[ ! -e "${2:+$2/}$f" ]]; then
     listfiles+=("${2:+$2/}$f")

That seems to do the trick here.

PS Sorry about sending the reply privately, I'm not so used to gmail
and mailing lists, it defaults to private replies, and reply to all
cc:s the list instead of the sender...

--
Mikael Magnusson


Messages sorted by: Reverse Date, Date, Thread, Author