From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7294 invoked by alias); 13 Aug 2015 10:19:04 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36146 Received: (qmail 2512 invoked from network); 13 Aug 2015 10:19:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1439460741; bh=2EnDJEuL8vAdcrR41yAYTmQs6nA9OjyXjpD86yWWg4c=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=gLQUhXFfpAQG0ICwDqmi0gvPb4AGc/CivzWrTgdWadB5hw2LqR+5CB71Os6xIvdzkkXgEGjcj11yQUOMjs+3FBO2sWY4LKaIerJf69NhOvdhu0EU4qq/xdw7bXf+T07scmg/8McZ5i1O71THTIf3myirnpn5gJ8e4y35yP1qLP4q25VC79s3SJMkD3F7+vsWgRDZZ8UqDgybfgEpRo9g80edPVknAl3iBPAnzlIxj80IP2AUfyWAycLVTeDaw4O51jGQQz5jn2+HSgN6PxH/5+llddV4ZAofizoe2FLfMBxOgjjRArUmoDHPaciBNllSbe5rYDufjU1Z/XcaSCjI2A== X-Yahoo-Newman-Id: 153051.35722.bm@smtp117.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: q921AJUVM1m8_MZIsth8O0XEmzK8CWo69vn0HzOpf48sZPH jg6xbF_1gKmkCgGMqV1FxDY._xqSp4hAY_4yPzXeaRURSRb4MdZvYrqvZ3hO wpvdYVO0JK_d8Ro0iGaTQpJVQu0FrpXxegc_pmEt2wlVzoOAc6GYQvdkDQK3 CCnfW3wmT7p_PPxWWJd5kFsqflOB952GeM0DigvD.RTRKeW66VL6pp1BveLT 1MyI39O1zApohXfAIXzXX6iwtgd6A5_k6witQw_vr0AO69ZeaX77BsdHfpUE W_2oYuco7NjGOauy5X.fqbVH_EcR3I3jr7NkWBxnHDnoSQSjkIevNFpJkfOy T8WcT1TVxuQY.YJ7GOmAEbQTwBATl4x8XLtD9R9l3oI8Rx_huimpDZJSHZXO CCfUZnmg9XYAngqJ3sgtH5cVpcRwdyiyjBYesz4k8z5X_xGDSTAF6tKP4J8J IuqAOJqC8fiDMQaZF2R0B9YRhPoN09slaRxaKFRgFq_JAoD05gKHcey4Lgus 4qX1Hzf1k_d8o9AcMHOuAv905Aur8eA-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <150812154611.ZM14299@torch.brasslantern.com> From: Oliver Kiddle References: <1439348703-8268-1-git-send-email-mikachu@gmail.com> <1439348703-8268-3-git-send-email-mikachu@gmail.com> <7518.1439400015@thecus.kiddle.eu> <150812115958.ZM14070@torch.brasslantern.com> <150812135724.ZM14165@torch.brasslantern.com> <150812144433.ZM14263@torch.brasslantern.com> <150812154611.ZM14299@torch.brasslantern.com> To: zsh workers Subject: Re: PATCH 3/5: _imagemagick: complete all files if image files didn't match MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12098.1439460739.1@thecus.kiddle.eu> Date: Thu, 13 Aug 2015 12:12:19 +0200 Message-ID: <12099.1439460739@thecus.kiddle.eu> Bart wrote: > > I was implying that you probably CAN change both to other-files but the > opinionated one here seems to be Oliver so let's give him a chance to > chime in. Had I been paying enough attention in 2008 to be opinionated then, I would have questioned why we need a special style corresponding to a specific user preference that ought to be covered by file-patterns. That mail, briefly mentions that the reason for it was that file-patterns was broken for zmodload completion. _zmodload does: _files -W module_path -/g '*.(dll|s[ol]|bundle)(:r)' && ret=0 The use of (:r) there makes this a borderline case where _path_files should perhaps have been used but it is actually -/g that is causing the problem. -/g with compctl gives you directories mixed with globbed files which was very useful at the time. It is still just about relevant to _path_files but with _files, if it actually worked, it would just be overriding user preferences which is missing the whole point of _files. _files does: [[ "$type" = */* ]] && glob="$glob,*(-/)" Either comma was at one time special to _path_files or this was never tested. In the patch below, I just remove it. The one other use of -/g that we have was in _command_names with _path_files. In that case, I can't see a reason not to use _files instead. > Anybody else want to comment on the likelyhood of the tag changing from > all-files to other-files causing a problem? I would actually be inclined to suggest that other-files should be globbed-files: _files is defining three defaults for file-patterns corresponding to whether -g, -/ or neither was specified. So how do you override just one of those file patterns? If we define _files without a -g as being equivalent to _files -g '*(-.)' then a single file-patterns default would suffice. It'd also mean all-files would only be used as a fallback and globbed-files would be the tag for all the files when no glob is specified. It might be better named in that case but it is the tag we already have for specifically requested files and in that case, all files are what have been selected. Furthermore, there are issues to consider of when we actually want a specific set of directories to be globbed for. The single default I have in mind would be something like: '%p(-.):globbed-files %p(-/):globbed-dirs *(-/):directories' '*:all-files' That would be more likely to cause problems for someone's setup than renaming an all-files or other-files tag however. It would probably be a good thing if we can avoid every little completion function needing to do stuff like _files -g '*.png(-.)". -/ would mean we actually want to select directories. Any opinions? Patch below is just for the zmodload etc issues mentioned at the beginning. Oliver diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index a8ba9b3..b9ff12b 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -51,7 +51,6 @@ else fi if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then - [[ "$type" = */* ]] && glob="$glob,*(-/)" pats=() for i in ${tmp//\%p/${${glob:-\*}//:/\\:}}; do diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload index e144b98..57fb990 100644 --- a/Completion/Zsh/Command/_zmodload +++ b/Completion/Zsh/Command/_zmodload @@ -68,7 +68,7 @@ else _requested loadedmodules expl 'loaded modules' \ compadd -k 'modules[(R)loaded]' && ret=0 _requested files expl 'module file' \ - _files -W module_path -/g '*.(dll|s[ol]|bundle)(:r)' && ret=0 + _files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0 _requested aliases expl 'module alias' \ compadd "$suf[@]" -k 'modules[(R)alias*]' && ret=0 done diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names index d9fc62d..940f341 100644 --- a/Completion/Zsh/Type/_command_names +++ b/Completion/Zsh/Type/_command_names @@ -17,9 +17,7 @@ defs=( ) [[ -n "$path[(r).]" || $PREFIX = */* ]] && - defs=( "$defs[@]" - 'executables:executable file or directory:_path_files -/g \*\(-\*\)' - ) + defs+=( 'executables:executable file:_files -g \*\(-\*\)' ) if [[ "$1" = -e ]]; then shift