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 67fb1915 for ; Tue, 18 Jun 2019 14:48:09 +0000 (UTC) Received: (qmail 8592 invoked by alias); 18 Jun 2019 14:46: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: List-Unsubscribe: X-Seq: 44425 Received: (qmail 29780 invoked by uid 1010); 18 Jun 2019 14:46:25 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25482. spamassassin: 3.4.2. Clear:RC:0(209.85.166.53):SA:0(-2.0/5.0):. Processed in 0.76129 secs); 18 Jun 2019 14:46:25 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.53 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=MAoXsZEbRXUQA3f0zbjpY3EvriNuItYNEzEzfwLUtEM=; b=CQd98uZXwSjeRBcPCb0UBWydmEosxBeaQWg1ImLtIo631vXY38tREr2IJS4BvXgPwm 28MHBfKqtpJ0iOAuOrzd0yV7dcJLzEs1Z6M/Xd4K2Img2vA6nPH9TLP6fP1H5FIKm8eF J0Pj2PaAyhKdmyQl6kmY0Ti9qJyrLhzJnS3OvNKdU8T4qHWK8R+2nIjyUVDr4Jguiu40 Rn1dNqz5DN2A7+MEb6BpBLGWokYNbRuZvQZvZKzpwtvO7hlofWAkB2uLDbDNkol7vjgv cPYmmdiKPci7DvV+fMA8xoIyhM/tDd/0MhIFsb1SJ6IXHWg+4dBBNDcnJ2NX0xMgYCUs CyLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=MAoXsZEbRXUQA3f0zbjpY3EvriNuItYNEzEzfwLUtEM=; b=cJxE8fsoUw19lJkRvNpae+xzPUXu1C21Gl/IwaBa/MNgm80XUJp+w1qSLrEYDIEvR7 NI+V4FLQoSYHio6YjqBtqAzKYJfFZyfsJsicgVqD7gY4cGm2A6i1Gz/tSK7ufqk/nDTL bXX2xQZRoJveIyFNg4Jql9ulrefCd1z6azXLVQRK4kW4X2R4OxRBzlyZmvR17wxG6iZi xjEkhdgNzOyVLr8NjQGZhWpkd6eDIquuT3y4t1HDi5ioxcYgxNQNzOE1ATfnLSk7se+Y BqCqATDKdnxw1dtMwmafWKd6DYPU4A+osb+TIoDzwFhZuVcGO3iSKCBibSjQt37V+3o7 /Hyg== X-Gm-Message-State: APjAAAWfkUpJOl7rNFc837QUDAxgt5XfYk29li3aDTyUJlQJapvaw9Xx VrFp8hLC3f/Ruu+69o1WTcZJ0xOVJ8At0Fezrlc= X-Google-Smtp-Source: APXvYqyv7cCbL8eJxRiBEk71FQuc7IyLL44dFtWmJGe7yBzL5trrYqUq5nhJxJczwc+tv3lKeZEzmwOfynZZTeFrvuU= X-Received: by 2002:a5d:9e48:: with SMTP id i8mr6682306ioi.51.1560869151811; Tue, 18 Jun 2019 07:45:51 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1560866087.7731.18.camel@samsung.com> References: <1560862806.7731.11.camel@samsung.com> <523ba6f0-651a-444a-8ceb-c7c4ec186b20@www.fastmail.com> <1560866087.7731.18.camel@samsung.com> From: Mikael Magnusson Date: Tue, 18 Jun 2019 16:45:51 +0200 Message-ID: Subject: Re: PATCH: trailing components To: Peter Stephenson Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 6/18/19, Peter Stephenson wrote: > On Tue, 2019-06-18 at 13:37 +0000, Daniel Shahaf wrote: >> Peter Stephenson wrote on Tue, 18 Jun 2019 13:01 +00:00: >> > >> > I needed to preserve a number of trailing components of a path (other >> > than one) and couldn't think of an easy way of doing it. Rather than >> > craft obscure pattern substitutions, or use an ad-hoc expression to >> > strip the prefix, I came up with a patch to add an optional number >> > after >> > the "t" in history style modifiers to do this. I put it after rather >> > than before because history-style colon expressions are quite sensitiv= e >> > to what the first character is after the colon. >> > >> > Before I come up with tests and fix up the ensuing failures, you can >> > let >> > me know if there's a better way of doing this to save me the trouble. >> Here are some alternatives, but I'm not claiming any of them is better >> than =C2=AB${foo:t2}=C2=BB: > > Thanks, it's useful to know other people's thinking for comparison --- > to be clear, what I was hoping for and lacking was something along the > lines of: > > echo /blah/blah/blah/**/*.oogabooga() > > even if wasn't quite as short as :t2. I could live with a > few more characters but a loop or complicated substitution would lead me > to propose adding the new code instead. The only complaint I could imagine here (but I'm not making it) is that this breaks echo $foo:t42 to echo the last path segment followed by the string 42 Would it be possible to limit the new syntax to *(:t42) and ${foo:t42} where previously the 34 is invalid (or at least silently ignored)? If it is I think it would be nice to do so, but I'm not going to object if it goes in as is. It's certainly nicer than the expressions suggested earlier in the thread. --=20 Mikael Magnusson