From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8025 invoked by alias); 15 Aug 2015 00:52:12 -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: 36176 Received: (qmail 2958 invoked from network); 15 Aug 2015 00:52:11 -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 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=YNvIZKJy4cQ6/uhRmcBRqZLduiIQQiyjgPjJMWg52J4=; b=vTky8KErlMqDE7pfuywfwlvnsqiXQOoPPYD7dr4/YTk29X7y1uQL1sI3TsGbgdoOQd oAoDalpu/d/o7WCpoQSvM1R67T3m6LMwTKL9O/YeNbHljTyELXOvZmI9duqZksb66TdH DjuiDY+S4DIMFQplPouMTq4TWm6vsz8X8hpMu5tGKbeg92uNNMI9oLn9Rw5r9UfhrrwT 5CwmHVELs0uGe5D/6AShWWDEKUa+gr6GUG30jI9W5HNmpIWNO1iVps+SniMVVnG5AlQa A52jjjogUTI/T86rLun+CmxHomIO628qLestr9zkIfmQeT6iIZhfJu67vxdm7utXlA4o TuUw== MIME-Version: 1.0 X-Received: by 10.107.31.134 with SMTP id f128mr43435887iof.19.1439599929764; Fri, 14 Aug 2015 17:52:09 -0700 (PDT) In-Reply-To: <150814170556.ZM15448@torch.brasslantern.com> References: <1439348703-8268-1-git-send-email-mikachu@gmail.com> <1439348703-8268-3-git-send-email-mikachu@gmail.com> <150814170556.ZM15448@torch.brasslantern.com> Date: Sat, 15 Aug 2015 02:52:09 +0200 Message-ID: Subject: Re: PATCH 3/5: _imagemagick: complete all files if image files didn't match From: Mikael Magnusson To: Bart Schaefer Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Sat, Aug 15, 2015 at 2:05 AM, Bart Schaefer wrote: > On Aug 15, 12:31am, Mikael Magnusson wrote: > } Subject: Re: PATCH 3/5: _imagemagick: complete all files if image files di > } > } > - _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" > } > + _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" || _files "$@" > } > } Now that I'm looking at this line for the 500th time, I realize that > } the ~ in there makes absolutely no sense, and shouldn't really work. > > The ~ there is in fact useless, because the expansion is quoted, so > converting characters within the elements of $format into patterns > doesn't do anything. > > In fact it's more likely that ${(b)formats} is wanted so that pattern > charactes in each of the format strings would be quoted, if there were > any. (That *will* persist because it's a textual change inserting > backslashes.) Then they'd remain non-special when the positional > paramter is expanded later by _files. > > } However, it seems to be totally ignored and harmless. I tried changing > } formats to an array, and using this instead, > } _files "$@" -g "*.(#i)(${(j:|:)~formats})(-.)" > > Same thing. > > } And it works the same, next I tried (actually I did the other way > } around but this is easier to follow) > } _files "$@" -g "*.(#i)(${(~j:|:)formats})(-.)" > > When you have an array, "${(j:|:)array}" generates the set consisting of > each of the quoted array elements, and then joins them. The vertical > bar is not part of the quoted regions, but it's also not interpreted as > a pattern character. > > "${(~j:|:)array}" generates the quoted elements and then joins them > with the pattern character represented by vertical bar, so you get the > expansion immediately as you noted. Okay, I guess that makes sense on some level. :) > } -formats=jpg:jpeg:jp2:j2k:jpc:jpx:jpf:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xcf:xwd:xbm:xpm:yuv > } +formats=(jpg jpeg jp2 j2k jpc jpx jpf tiff miff ras bmp cgm dcx ps > } eps fig fits fpx gif mpeg pbm pgm ppm pcd pcl pdf pcx png rad rgb rgba > } rle sgi html shtml tga ttf uil xcf xwd xbm xpm yuv) > > If you're going to do that, you should also declare formats as an array > instead of a string, just for completeness. Good point, I'll squash it in when pushing. -- Mikael Magnusson