From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5168 invoked by alias); 12 Aug 2015 18:12:25 -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: 36134 Received: (qmail 26655 invoked from network); 12 Aug 2015 18:12:23 -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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vxA6SYAHPgI5fMl9YEHR8sNTTzunI765pu1N4r83xqc=; b=jfcfW7jfWbTk6o7pC2el9FEFfENlE5jCjJlw5VmWCRnuSR5+2yGtiO1ZDqB4iDc/Tw VL7C5ZU5qz8pFfK1aEpqmL8NM64tyoTecvP0+sOqMTF18TpTZB376T7V4UuhUjZIgZjy IbV9RzGABjkMo6t6PEFkKGSCU01dSp3oxWl3zNWU2PrlSma9tP38N5R5f3mfMMigdpls gip5aCQfuPFDTqS73QB0fYIbSV8yhGFnHgmNbWCAUBlpPEj2seNiKj8512M3id3t86N2 pBxCpHmrztL+u7TRJje2/B0P2Ei4VSy3VFSGoGLekaImfmKsf9+jxMblR8lZP/O9v2zB x6RA== MIME-Version: 1.0 X-Received: by 10.50.30.9 with SMTP id o9mr24074538igh.36.1439403141211; Wed, 12 Aug 2015 11:12:21 -0700 (PDT) In-Reply-To: <7518.1439400015@thecus.kiddle.eu> References: <1439348703-8268-1-git-send-email-mikachu@gmail.com> <1439348703-8268-3-git-send-email-mikachu@gmail.com> <7518.1439400015@thecus.kiddle.eu> Date: Wed, 12 Aug 2015 20:12:21 +0200 Message-ID: Subject: Re: PATCH 3/5: _imagemagick: complete all files if image files didn't match From: Mikael Magnusson To: Oliver Kiddle Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Wed, Aug 12, 2015 at 7:20 PM, Oliver Kiddle wrote: > Mikael Magnusson wrote: >> - _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" >> + _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" || _files "$@" > > _files already does this internally, configurable via the file-patterns > style. From zsh -f or in my full setup, this already works for me. This > same change might equally be applicable to every use of _files with -g > that we have. > > You might want to instead check your file-patterns styles to see what > you've configured that broke this. You're right that it works in zsh -f, however, I don't have any file-patterns styles set and it still doesn't work in my setup. This is the line that breaks the desired behaviour, zstyle ':completion:*' list-dirs-first true Which I find to be somewhat unexpected. This seems to fix it, and brings the l-d-f case in line with the default case below it. diff --git i/Completion/Unix/Command/_imagemagick w/Completion/Unix/Command/_imagemagick index c43086c..115cb01 100644 --- i/Completion/Unix/Command/_imagemagick +++ w/Completion/Unix/Command/_imagemagick @@ -14,7 +14,7 @@ typeset -A opt_args formats=jpg:jpeg:jp2:j2k:jpc:jpx:jpf:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:p if (( $# )); then - _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" || _files "$@" + _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" return fi diff --git i/Completion/Unix/Type/_files w/Completion/Unix/Type/_files index f4a8fc2..13f4871 100644 --- i/Completion/Unix/Type/_files +++ w/Completion/Unix/Type/_files @@ -72,7 +72,7 @@ elif zstyle -t ":completion:${curcontext}:" list-dirs-first; then glob="$glob(#q^-/)" fi - pats=( " *(-/):directories:directories ${glob//:/\\:}:globbed-files" ) + pats=( " *(-/):directories:directories ${glob//:/\\:}:globbed-files" '*:all-files' ) elif [[ "$type" = */* ]] then pats=( '*(-/):directories ' '*:all-files ' ) else [extra context for reference] pats=( '*(-/):directories:directories *(^-/):other-files ' ) fi else if [[ "$type" = *g* ]]; then # People prefer to have directories shown on first try as default. # Even if the calling function didn't use -/. # # if [[ "$type" = */* ]]; then pats=( " ${glob//:/\\:}:globbed-files *(-/):directories" '*:all-files ' -- Mikael Magnusson