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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30434 invoked from network); 15 Jul 2023 16:22:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Jul 2023 16:22:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1689438163; b=JKmEOK1PiLlJrIFpcg48TFPBg72ocAr52WhRv0Wk00KEAmC9J33hqWqLYvMuysdAKF3WaM3Smb TWXIzX0k7P9VAnM0ZdHR5oEjYftyTM8msnLiv8EgXt/Wj/LbBL2Tu8uo2hFSlk1oeDqu+f3DVw HcUa/HwEMCv1DvMiJBNTFewppF4APiGh/iNBkOWcwGUOq8IvhWQYVrNyqZ22K5zhwQIHrPENKz fgIcw0MSGU/tVWrLd3h4TjIByJf2KiB9h+zHSFpNZ1pqzcmfS/Z+6gmR7L7T0Vn/bevD7UPFDU fIRKJdzGw6kf5FT2+gW1jaYUrYref9GpYQiUc55iN6lykA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f48.google.com) smtp.remote-ip=209.85.218.48; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1689438163; bh=pqp7I+rDpcX6VSqv41TgmuA/ND8d0vacUem3tBMCbxs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=Q/TrpunzdA9iRE2kn2/mpQl0ixT3K7qPZUSd0TBUbWjm3JYZrjdvASz1B4zDfqLt2Nz1f4JqAP KwCu3P0hCEm7U9/NzLmMK2oytW8UuHUsVyanRxifwT3yE/CwtCexzzAb+vUcAvGSlbzlc1lcJ4 bGMgjXGdcVy2hipC6IelKY6wJ8S89S6vSsqGkEqsZPiOEXKTj4avSeYIpnXygjYz4zbBgCys58 A+pDF0KoDKitaoZ5dv6MTun3qNQ0wVUu5NgWSFeNtTwwDnRi1ZuHDoIcftMqCdqPJuuENzFxzM jKgooyuva1FgacyjkGr96/9580N853zfM3xrPWL6DMPY9w==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ODN/PS+gTzvGHxB1+GOlyrO0W+jASGdw93xIKOdVJrM=; b=kjYoXeSrQmcwslS9oPBUVV3U+b 2IyroAGXniU7J88XSJ9tUUtZ+sTNcALE/c06KP94yBsYcfK4u8ph3MAJ72MXK6ZbLPCC7nd0I3W3j JuVSwDqLOb0VzKwC71bu0tfKraHOzsosJlYTzjeAGBH0o1kVv0aARbvzqN2pIKJyW+TRMxxcOXYGu OsiRBvVSUxVL+7CSEcrdfLjy4arnYiSA6JUq2ELI9IKJ4jVZi7l9ygc2V9UkfEBW2ZcaQnKOnt8Ei 29bifxkuMGIRw/ra7i5IEQa5MHJyJ/yGVCienSzZzEqQ4peLaZOd1UsBiSD36SZOOhZSYzkH44Cec O/jfW/6g==; Received: by zero.zsh.org with local id 1qKi2b-000GJ1-CE; Sat, 15 Jul 2023 16:22:41 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f48.google.com) smtp.remote-ip=209.85.218.48; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f48.google.com ([209.85.218.48]:49636) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qKhx6-000Fqm-8I; Sat, 15 Jul 2023 16:17:02 +0000 Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-992b66e5affso420186166b.3 for ; Sat, 15 Jul 2023 09:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20221208.gappssmtp.com; s=20221208; t=1689437819; x=1692029819; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ODN/PS+gTzvGHxB1+GOlyrO0W+jASGdw93xIKOdVJrM=; b=sTWCIsO6UmX8JpqwUQ3yqJe0RM7pmYYn10G28IfsHTUCmATsqMoMonIiY1c8WNo0L9 uQopqQdJYXRjAkvtoFkqCjwtNnQZz3q4IAIZE7yCB7DjqGCZAuhBSaMvUiBXy5H/FYjl E66tLmEcEfO8EMV1Iz7P76zXQ2JaI9VqprperCCMvl7/pxDvZfraMphfP1Hd1vl8QovV WSdl4VCpEvB5pILVzyU+IOg7bS3UswyReoBl5Ro3Y9rXOnYvJ4j98Wk7XADoW0ZE5dA3 XjYPNvwRD3BH/3LI1Yb1MfV8CO/X3I8UEsrvn1SchBR1Zu5cLu9Sw0B4ONTAkarjsqhu /oXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689437819; x=1692029819; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ODN/PS+gTzvGHxB1+GOlyrO0W+jASGdw93xIKOdVJrM=; b=Z6ird4uCMsN/R9MSlgkyOkESNRL0eBW61yN+jH3e8lqsPd+JQ9dHSdDyJqSocnNyhG 1dRPoXFh8kOsGUbJh6tIulCYBBjvY/IRRJTTxetqxyxP9Dkcbf+/QvhLNOl/LHBiloPu xz78Sl4XjehCvodTfE3BSZkOa2OZ+gEMOKtnmmivktsbJrbG4cK9/UdOu/e47kFSjKgL ph4vXCUmJD+LxnTrL936r9g06LC3NLzmj0RfkolqI/+GzCP7Wlmh6A2j+izNVgYHAz9r HEzEOOw9X5bRBeaEjCr+HXLg7XSxUDGU4gEUllPT4OTyYbMGpk7CUCEgHsE+cEZll5nC aaiw== X-Gm-Message-State: ABy/qLa1y3FSXdNgY3pwjfgm2mmgdhFxsoZKPUgnFaHFV+rygUNEpdQK zyuBDb9xdX9WQtHudIr2046/HpKx5EMxG6wCtvfl1Q== X-Google-Smtp-Source: APBJJlECYOiqcjnu5RJ8gVDV0rILAdmhQecSrjAMYQdwaaVSbU1D73DoFfbXrBwWL+/MesSbre4NxpyhulOO9QNL1Fk= X-Received: by 2002:a17:907:5013:b0:988:6491:98e1 with SMTP id fw19-20020a170907501300b00988649198e1mr6144737ejc.42.1689437818982; Sat, 15 Jul 2023 09:16:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sat, 15 Jul 2023 09:16:47 -0700 Message-ID: Subject: Re: _files -g offers files that don't match the pattern and conversely To: Johan Grande Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 51938 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: On Sat, Jul 15, 2023 at 6:32=E2=80=AFAM Johan Grande wrot= e: > > % _f() { _files -g 'c(.)' }; compdef _f f > % f > a b # even though 'a' and 'b' don't match the pattern The only way I can make this happen is if "a" and "b" are directories. _files will complete local directory names if there are no matching files. > % _f() { _path_files -g 'c(.)' }; compdef _f f > % f # nothing _path_files expects the pattern to match directories too. > % _f() { _files -g '^(a #)(.)' }; compdef _f f > % f # nothing, even though 'b' matches the pattern The space in the pattern needs to be quoted, it's being taken as a word separator. _f() { _files -g '^(a\ #)(.)' } I haven't investigated possible fixes. > % _f() { _path_files -g '^(a #)(.)' }; compdef _f f > % f # becomes > % f b Unlike _files, _path_files is applying the pattern directly and doesn't have a problem with the space. > Also, and this is the same for _files and _path_files: > > % f() { echo $@ } > % _f() { _files -g 'c' }; compdef _f f > % f # becomes > % f c # even though there is no such file There's only one possible completion, so it's offered.