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=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20706 invoked from network); 21 May 2020 12:44:37 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 21 May 2020 12:44:37 -0000 Received: (qmail 10054 invoked by alias); 21 May 2020 12:44:32 -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: 45882 Received: (qmail 6805 invoked by uid 1010); 21 May 2020 12:44:32 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25814. spamassassin: 3.4.4. Clear:RC:0(205.235.26.22):SA:0(-1.0/5.0):. Processed in 2.385823 secs); 21 May 2020 12:44:32 -0000 X-Envelope-From: SRS0=Oa4a=7D=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at bounces.park01.gkg.net designates 205.235.26.22 as permitted sender) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 X-YMail-OSG: qwbzBIUVM1nEwruKME7VueUIUarfWv2CT7H5WGAR0nfvOXZwTpo..gUtWFvlfq1 k1e0K80T.srnIZ0wo_LOUvcU3Po3J6IZ26OlCHWzhSv7zoKdm4nKbq8UmiG_d69X4zLwWx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R9R5AiLP.NI_M8KiypIo5LK5.XKcwCaXDaE9y7tPXLUNlJMyh6OcVmlqMLmzpZ_9 gs5mfLdHdmlGYrUEhR56vDfVNvEi4oXYY_TpIeNlujejHm.cw8FcfhueeBDT08SlLVJuElTR4i2. kzWx7EFHztxeIsj2XO9f8ZcoKg3tvvZ8apGo2vynBf9ZjpjDekxPp5Hu_A4LmK656U9NuKwOZTcO qg1KiJiZzgA90WhE- cc: zsh-workers@zsh.org In-reply-to: <3932941583753550@myt2-a7d7570d35ff.qloud-c.yandex.net> From: Oliver Kiddle References: <3932941583753550@myt2-a7d7570d35ff.qloud-c.yandex.net> To: oxiedi@yandex.ru Subject: Re: [PATCH] Merge ignore and deduplication patterns in _sequence MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <57003.1590065025.1@hydra> Date: Thu, 21 May 2020 14:43:45 +0200 Message-ID: <57004-1590065025.229907@6d4A.1jvX.h7ap> X-Mailer: WebService/1.1.15960 hermes_yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.6) On 9 Mar, oxiedi@yandex.ru wrote: > First, it fixes the following bug: > > % zsh -f > % autoload -Uz compinit > % compinit -D > % compdef '_arguments ": :_sequence compadd - 1 2 3"' seq > % zstyle ':completion:*:*:seq:*:*' ignored-patterns 2 > % seq > _sequence:40: command not found: -F > > Second, it allows a user to ignore matches using the ignored-patterns style. Sorry for taking so long to review this patch. Currently, _sequence ignores a -F that is passed to it and in general it is good for helper functions to accept as many of them as possible. As I'll explain, I think the omission was intentional in this case. I'd be interested in what other people think because the change is perhaps more useful in actual practice. A compadd option passed to _sequence would normally apply to the whole list rather than individual elements. Using -S as an example: _foo() { _sequence -S/ -s, -n2 compadd - 1 2 3 } foo 1,2 - completes the / suffix, we have a complete list (-n2) So / is a suffix of the whole list rather than of individual elements. So if _sequence is passed a -F option then arguably the pattern should apply to the whole list: -F '(1,2)' would exclude the list 1,2. However, there's no simple way to implement that and it doesn't seem especially useful. And in practical terms, while we normally have _sequence wrap _wanted rather than the other way around, sometimes it is the inverse as in the _arguments example. I'm inclined to apply the change. Anyone else have a view? There is one caveat which is that for the array passed to -F, we rely on the dynamic scoping of local variables in zsh so if _sequence calls a function with a local variable name clash then things break. ign is very commonly used in completion functions. dedup was rather less common. Perhaps we should call it _sequence_ign or something. I'm not worried about nested use of _sequence because ignored patterns from an outer _sequence are unlikely to be especially helpful. Oliver