From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: matcher-list doesn't work with some completers?
Date: Thu, 06 Jan 2011 08:41:09 -0800 [thread overview]
Message-ID: <110106084111.ZM20766@torch.brasslantern.com> (raw)
In-Reply-To: <AANLkTinw=XEV+CA1wuMcNEpdXb--A2e42QcCf_TdbKYg@mail.gmail.com>
On Jan 6, 11:14am, Mikael Magnusson wrote:
} Subject: matcher-list doesn't work with some completers?
}
} mkdir 'a directory'
} zsh -f
} autoload -Uz compinit; compinit -D
} zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' +'l:|=* r:|=*'
} ls dir<tab> #works
} du dir<tab> #nothing
This is a bug in _du, it's returning a 0 status without ever adding any
matches, which causes _dispatch in turn to report success to _complete
which then skips running the matcher-list.
This in turn is because _du checks for a state transition to handle the
--time and --time-style options, and that case statement masks the
return value from _arguments.
I don't know for sure whether the fix is to save the return value from
_arguments and then return that in a (*) branch of the case statement,
or to return immediately if _arguments fails and not bother checking
the state transition at all. _mkdir does the former, so ...
Someone with copious free time should do a sweep of the completion
functions and make sure they're correctly propagating return values
from _arguments, _wanted, etc.
Index: Completion/Unix/Command/_du
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Unix/Command/_du,v
retrieving revision 1.4
diff -c -r1.4 _du
--- _du 21 Dec 2010 16:41:15 -0000 1.4
+++ _du 6 Jan 2011 16:38:35 -0000
@@ -1,6 +1,8 @@
#compdef du
if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
+ local ret=1
+
_arguments -s \
'(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \
'--apparent-size[print apparent sizes rather than disc usage]' \
@@ -27,22 +29,24 @@
'--time=-[show time of last modification of any file in the
directory]:property:->time' \
'(* -)--help[display help information]' \
'(* -)--version[display version information]' \
- '*:file:_files'
+ '*:file:_files' && ret=0
case $state in
(time)
local -a property
property=(atime access use ctime status)
- _wanted property expl property compadd -a property
+ _wanted property expl property compadd -a property && ret=0
;;
(timestyle)
local -a style desc
style=(full-iso long-iso iso +)
desc=('full-iso' 'long-iso' 'iso' '+FORMAT like `date'\''')
- _wanted -V style expl style compadd -d desc -a style
+ _wanted -V style expl style compadd -d desc -a style && ret=0
;;
esac
+ return ret
+
else
# based on $OSTYPE = solaris2.8
local xdev='[skip directories on different filesystems]'
--
next prev parent reply other threads:[~2011-01-06 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 10:14 Mikael Magnusson
2011-01-06 16:41 ` Bart Schaefer [this message]
2011-01-06 17:24 ` Bart Schaefer
2011-01-06 18:42 ` Mikael Magnusson
2011-01-06 19:00 ` Mikael Magnusson
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=110106084111.ZM20766@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).