From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20051 invoked from network); 24 Mar 2022 19:25:59 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Mar 2022 19:25:59 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1648149959; b=eQdq5rYYJktZiQh/gAI4SwtGUODTHqdt1GarPL5slvVLoW8ggSJJB0xDU24EiXhu/enPCeGyEu UoReUg9pL9RbwpuYdfMrV6hBE4nEfkOjA82zS90pGJ5xPRudlbXnBgWtudfXkNvmC4E7qNEs0X 8lXmko3ribxTLsH3G3mSIFrrnfstuPagqJlEIpI3v7x++QG/fufU4aIOKqENo52B5gPlBkw8mX ePTjYv7uFdaY60yioVvS4e/0c4t8O1566sBkJ7UT3Lw0JYlNJmpYEG7vJvqQK08sH71BFt1ZMB la0v1Dr36h6vJHrEUn5jSZR9yDlUSu7CJTQgGapl+eOKlQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pf1-f180.google.com) smtp.remote-ip=209.85.210.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1648149959; bh=dpCGqQmNCPHheVIfIOLgrkncdj9pCe5UolatqXJE5rM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Date:Subject:Cc:To:From: DKIM-Signature:DKIM-Signature; b=qwNCGY0yXP9qHBFy4DxDQvGU0Y3BA1ALQykeHCu3/bLV3Hk7ikJ3H2Z7RBPNRuAw4CBxwHb6Jq DRhg1GFnSBgVoYkRwfP+sWVecq8FYmYhPIkB0sMN8q439aOcr2moFFevCbNhma1sic2PTJf+xr m1aUadNBRu9ESv4WNzOnz4wjiBSHlBYMhZ1iJYI2BVFCbEV+9FHKtibHq8a76jkcE168o4Ek6z PJCuWP6nAZlVe1wBeTWpyf7LcHcKbb/SC4lSxcu+gD2v8FbIV7ImZkGCetiEHCqQzWudMJ9NcD w1DlEe7uG5b+AVAnY3pcPMSK5eb9hVjWxt0EX8hb6ucmzQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=Tgz+zQaWI3aQ3UgCNDRSDQpP2W6ZgcAVIWhIuxFTM8k=; b=Oqa198HBurth6Cdxw6aky+xyIY 4lJEdog5c09G06x88Msl4zlZF7pBPIGH/Y60XvFt8UzJNxzB6xxQU8wylMhet/H+5XANodslZT+Kj o9Y+2YznAzb3yqCUHTAs0ngBnQ4oyDWdfF1d6KAQl5TzQDuJFeAWhs6yHWfxEsmFTyyV2G23bcRqS yERrzywvyyzPpClf3+tobN4tG84hvCHWXBR2pdtjhGMMeKuqOLUSNmBM4bD17zc1pr5/d3RuMMXoJ IfwcrxEHV8fnL7V+sJHqmnBWwVNNOdH0ejqTxvz5vyd/GXnYnUNSYWMEDQc59X3yf6O8YjPF3kBuB ALrc7Izw==; Received: from authenticated user by zero.zsh.org with local id 1nXT5q-000AnG-6L; Thu, 24 Mar 2022 19:25:58 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pf1-f180.google.com) smtp.remote-ip=209.85.210.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pf1-f180.google.com ([209.85.210.180]:35521) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nXSK8-00087L-Nt; Thu, 24 Mar 2022 18:36:41 +0000 Received: by mail-pf1-f180.google.com with SMTP id f3so3394524pfe.2 for ; Thu, 24 Mar 2022 11:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version; bh=Tgz+zQaWI3aQ3UgCNDRSDQpP2W6ZgcAVIWhIuxFTM8k=; b=OpsnkLsjh4WoMiJVX+b8Rezlcsfi8PZF7AIHS/Sv576yw6QPZFT5eNqrkGYiyDcwIW jVQ1wfFc8iyhIK7J/d2x0v/QFy5afUScBFJmnCVRaZKSSv7xoE13BvGqNPXYdRnOenjT 4868rZs+hfzA6jRtEkM3J7cUxrn9OjpB8wNRYsP8bFxhDgIp8ThTdmhcgW/4zUdMHv0i RaLnb5yAHaGIvfQiQWLfXQhu6UgukY8zG+1ohNWys+wJw4is62e1hbIeDpyCZGZq1TYO PkBqijnbQYc3LWOdENda2H7RgQtsX0UM/p2cMAK9yRtETPvA1uDtnwQCjf/JH6M60SPX yABw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=Tgz+zQaWI3aQ3UgCNDRSDQpP2W6ZgcAVIWhIuxFTM8k=; b=I4JVEAlRPAt/Hvdl1Ksd/XRiE8I7zsS9pLELSaOoNcnRokgaDhE0vPUgPFFNgcl0qf 6CwPklggRodyX/LHbvAQiQtgMUuDymeuW8qwmxlPZxlw94o0lDWWPq2nFYk5uQHHj2uI AhWcxj6HGZNuWJDAltz6ljvLLnoWmSRvE2RK29DlaNx3FFfXUq3Tm/kMQgAlS8Q8eODN Gkpzh3Thfm8Cxf3B41l65Hz3N6Epgyj+XpdRd1qcw7MxDQesDYNh9F1P3l2kYgXqqZZv rwcKQW6yBC8YSEPPoPWPF7dcU/5DAKHxCYhNhj4vteVD9AiyuxGk1V73eDfnHH4vEBGC iM0Q== X-Gm-Message-State: AOAM531D8wWESK2lojPgaPnjZCVqjuX+Da+w3U/sXf114qv51eOJqz0d r4JPd282I6yymiP6Sekv4+0aiUs0GJA= X-Google-Smtp-Source: ABdhPJwARip9BvGblaX679BQwVaSNadEJETNcVDc61MmMonQrc/dzDmeu9dtQYJry3E92284/Y00eg== X-Received: by 2002:a63:4c24:0:b0:382:29dc:3345 with SMTP id z36-20020a634c24000000b0038229dc3345mr5010099pga.296.1648146999078; Thu, 24 Mar 2022 11:36:39 -0700 (PDT) Received: from localhost (24-113-151-6.wavecable.com. [24.113.151.6]) by smtp.gmail.com with ESMTPSA id k6-20020a17090a7f0600b001c63352cadbsm3546636pjl.29.2022.03.24.11.36.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 11:36:38 -0700 (PDT) From: Jordan Russell To: zsh-workers@zsh.org Cc: Subject: _time_zone gives me candidates other than timezones Date: Thu, 24 Mar 2022 11:36:37 -0700 Message-ID: <875yo3b3ka.fsf@smokey> MIME-Version: 1.0 Content-Type: text/plain X-Seq: 49891 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Hello, I am writing a completion function and I want it to complete timezones. zsh has the builtin _time_zone completion function for this, but when I use it I get filenames that are not timezones like `iso3166.tab`, `leap-seconds.list` and `zone1970.tab`. These are all files that live in my /usr/share/zoneinfo directory and are a part of my distribution's `tzdata` package. I would like _time_zone to exclude these filenames that are not timezones. I looked at the _time_zone function with `which _time_zone` after it was loaded and got _time_zone () { local expl if (( ! $+_zoneinfo_dirs )) then _zoneinfo_dirs=(/usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/)) fi _wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" - } If I modify it to just exclude those files that begin with a lowercase letter then it gives me only proper timezone names. I added `-F ([a-z]*)"` in the call to `_wanted` and it seems to do what I want. I've included a patch for this small change. Whether or not the change is acceptable or not comes down to whether or not it works to do what it purports to do and also whether or not _time_zone was supposed to return things like the timezone.tab files in the first place. diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone index cd924bb..c9442eb 100644 --- a/Completion/Unix/Type/_time_zone +++ b/Completion/Unix/Type/_time_zone @@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) ) fi -_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" - +_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs -F "([a-z]*)" "$@" -