From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10595 invoked by alias); 19 May 2015 22:55:13 -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: X-Seq: 35230 Received: (qmail 28850 invoked from network); 19 May 2015 22:55:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=lVBE4y/1XmbaVEOsSSAjbZGGvD5PLo9wH5zB01/jABg=; b=Bh5q/OyceFakdbGWO1/mr4Zcb5uFaehP+P7MqzxXdSfNuJvqDzHXTg0wBZMHMeoVrY yH0xr6CJ0tsRTLQyls7vHL7erGNryMV0NMZPK0V1LOJBznV0eJUrXbrqhxcl1OdEgMfR TtGvQ9XpZv8x+d3GKB6OaT22so/uWdCnf/qMpFDLVRS49Y4HFBXzRUrqJQX8xVY/3Tdd S1cJvI/0WOT0/xrleVpVPKMnXli09N4PWu/VGJ6c0iYGC3qN9pxj1CN4W4rUHz6GS3wb /pYhDwnJIC18YOLKXBQBdtgJOjWhm8qdCE4L4cyrjW+4h4y1btw+udR2Ot0S8INbAKab Cw2A== X-Gm-Message-State: ALoCoQkWoqS45f3PtFXH29CbTwQMaO0OMo47Bt+8ci1vau+QCYJtJbFNKNey+lq77713wm+h3cS8 X-Received: by 10.60.92.73 with SMTP id ck9mr26210209oeb.60.1432076109894; Tue, 19 May 2015 15:55:09 -0700 (PDT) From: Bart Schaefer Message-Id: <150519155506.ZM12383@torch.brasslantern.com> Date: Tue, 19 May 2015 15:55:06 -0700 In-Reply-To: <555AF946.6010202@thequod.de> Comments: In reply to Daniel Hahler "Re: Smarter matcher-list: skip previous sets" (May 19, 10:50am) References: <555A63A4.8060809@thequod.de> <150518174424.ZM2337@torch.brasslantern.com> <555AF946.6010202@thequod.de> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "Zsh Hackers' List" Subject: Re: Smarter matcher-list: skip previous sets MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 19, 10:50am, Daniel Hahler wrote: } } But is it necessary then to call the completion function multiple times? } Couldn't the matchers just loop over the result that has been collected } once? Every (completer, matcher) pair might call different completion functions or make different changes to the context. _main_complete doesn't know what the internals of a completer are going to do, so it has to make the call for each possible pair. It does attempt to break out of the loops as soon as the exit status indicates that matches have successfully been generated. } If I understand it correctly, the possible results would be the same } every time? No, not necessarily. } Where is the $_matcher used? } Is it in Completion/Base/Core/_description, in the opts to compadd? Yes, but also in _path_files. More often _matcher_num is referenced, so that completers that don't care about _matcher can become no-ops after the first attempt. Cf. Completion/Base/Completer/_menu } What would be a possible solution to improve handling with many } completers/matchers? There's no generic solution, this was discussed in agonizing detail back when the completer/matcher loops in _main_complete (and in _prefix and in _ignored) were put in place. It's up to individual completers or completion functions to avoid doing redundant work, which may be a point that (a) should be made in the doc somewhere and (b) has been forgotten in more recently-invented functions.