From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id cc7eb6df for ; Mon, 4 Nov 2019 20:51:19 +0000 (UTC) Received: (qmail 19056 invoked by alias); 4 Nov 2019 20:51:13 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24397 Received: (qmail 28082 invoked by uid 1010); 4 Nov 2019 20:51:13 -0000 X-Qmail-Scanner-Diagnostics: from st13p97im-ztdg18301101.me.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25622. spamassassin: 3.4.2. Clear:RC:0(17.41.193.160):SA:0(-2.7/5.0):. Processed in 0.759497 secs); 04 Nov 2019 20:51:13 -0000 X-Envelope-From: c.nebel@mac.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at mac.com designates 17.41.193.160 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1572900635; bh=wYv4nCDixxPz47JRrUwC6mUnzX2QqKQeChnlmI7+tA4=; h=From:Content-Type:Subject:Date:To:Message-Id; b=M9toEiRSCy/a+cTu8H92Q5y3j9OaP0Ea58cVXWDtMw3NIJq/NMhattFQ1cDCahgNJ Tg1SiH3AKSBZ7NZtIDGe/DdKrAA5g7zHS1IKOl0+gzK1ZTmEym2Vw0I/jQzIX4OuZ7 P0iK091Ks+J2ROgqtH+ovf0Kl+aMGgKzzwHR1F5Sc5/+JPSXiarL9PT45RJmoBJxm0 2TIbAziF7d8OfIVLtz1XLc2DziR+1kmHxKmBbj7p1plCCGdM9CtosZQSCyNbbCGKp6 /jeLis/6zRko6YAsDex5m7pbFPU8pcnirhwuZN+suOEJtGHlnEalD8ohsNbuzZsnAD ZYgnzxRDQaieA== From: Chris Nebel Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Use of (e:...:) glob qualifier with _files -g? Date: Mon, 4 Nov 2019 12:50:33 -0800 References: <206B06E5-8D28-4132-A0CC-BE070F9A5F7C@mac.com> <8F91689D-3069-4A1F-A4B2-3BF6F009B878@dana.is> <23662F36-B0E7-43FE-81AF-86C2C9D03044@mac.com> To: zsh-users In-Reply-To: <23662F36-B0E7-43FE-81AF-86C2C9D03044@mac.com> Message-Id: X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-11-04_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=-2147483648 mlxscore=0 mlxlogscore=762 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911040201 And I actually didn=E2=80=99t realize this until you pointed me to the = source, but darwinup *will not install* anything with an extension it = doesn=E2=80=99t know about =E2=80=94 it never tries to sniff the file = contents. So, I really do have a finite list to deal with, and can just = list them all. I=E2=80=99m still curious to know the answer to the = zstyle question, though. =E2=80=94Chris N. > On Nov 4, 2019, at 12:41 PM, Chris Nebel wrote: >=20 > Ok, fair. I=E2=80=99ve been worried that while on the one hand I=E2=80=99= d like to complete only supported archive files, on the other hand = people use all sorts of mutant extensions for them, especially when = compressed, hence just sniffing the file contents. However, a = not-terribly-complicated pattern will cover a lot of the cases. >=20 > My problem then becomes how to let people configure the completion so = they can use any extensions I didn=E2=80=99t cover. I=E2=80=99m = guessing that the answer has something to do with zstyle and the = =E2=80=9Cfile-patterns=E2=80=9D style, but I=E2=80=99m having trouble = turning the examples in zshcompsys(1) into something that works. To = make this a bit more concrete, say my completion code looks something = like this: >=20 > files -g '*.(cpio|tar|xar)' >=20 > =E2=80=A6and someone wants to also match =E2=80=9C*.cpgz=E2=80=9D = files, what would they do? >=20 >=20 > =E2=80=94Chris N. >=20 >> On Nov 3, 2019, at 10:56 PM, dana wrote: >>=20 >> On 4 Nov 2019, at 00:08, Chris Nebel wrote: >>> *(e:'file -bz $REPLY | grep -wq archive') >>=20 >> I'm not sure that's even a good idea. You'd be running an external = process >> against every single file the function encountered. On network drives = or in >> directories with many files that could take a while. >>=20 >> Also, i've never used darwinup, but it looks to me like it supports = only a >> select number of archive formats, which are guessed based on the file >> extension and enumerated here: >>=20 >> = https://github.com/macosforge/darwinbuild/blob/master/darwinup/Archive.cpp= #L323 >>=20 >> If that's the case, you should be able to just use = '*.(tar|zip|whatever)', >> which is much simpler and faster. >>=20 >> With that said, to answer your actual question, i think the reason it = doesn't >> work is that _files has an undocumented feature where if it detects = unescaped >> white space in the pattern it assumes that you're trying to supply = *multiple* >> patterns to be transformed into a brace expansion. Maybe there is = some very >> fancy quoting you can do to make that work, but at that point i think = using >> the + qualifier would be easier. >>=20 >> dana >>=20 >=20