From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15336 invoked by alias); 28 Sep 2015 23:49:01 -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: 36688 Received: (qmail 22573 invoked from network); 28 Sep 2015 23:49:00 -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=-1.9 required=5.0 tests=BAYES_00 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=m+wXAi68WjTOBa8ymIeoLTosP0bnBT9Vd65rFUdnTZk=; b=UVB+2l2VCXCRlkJdcbn/1GDpZjCk8D/1u/Dl0CD3vzxDp44ypqN2k3eHxXIiO9/ArE ubVmetOzGfFXG/xF+TWfKio2EVyhi0DsDB4GSar8Ia6E9K3BMvQTHPbEB7TAhgZQWkps txW0/g7Ag+EUwQ77YuuBT6nIZ1jUDAKT7iDhx2svLu6hy25rONLwzLPifNQSntobXnM7 J4eM3sot4JYdGmeb/eoUst1Fd3makOBY1Tqks6Df5ydsM68gZN1jdjyA6Q00xIZK8jFZ h+zv2uMWBXiaGXVuwVUaf63QPopRhzXAtH65MhGKeIKb+LQCgRyYxbIdh3CUGKFaZHYk qAhA== X-Gm-Message-State: ALoCoQlvoxuHrODlEM6kNplpi2gMAMWxMlYcoo7MNF864rILpbG765ot+m355+A8iIY82swS/J7T X-Received: by 10.202.69.5 with SMTP id s5mr7461516oia.123.1443484138543; Mon, 28 Sep 2015 16:48:58 -0700 (PDT) From: Bart Schaefer Message-Id: <150928164855.ZM29167@torch.brasslantern.com> Date: Mon, 28 Sep 2015 16:48:55 -0700 In-Reply-To: Comments: In reply to "Jun T." "[PATCH] handle options of _arguments correctly" (Sep 29, 1:55am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [PATCH] handle options of _arguments correctly MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 29, 1:55am, Jun T. wrote: } } This is because, at line 18 of _arguments, $tmpargv is set to '-s', } which is used at line 144 to remove -s from $lopts; i.e., -s is } considered as an optspec, not an option to _arguments itself. } A simple fix would be to move the while loop (lines 295-306) to the top } of _arguments. } } This leads to the following patch. Are there any unexpected side } effects of this? I don't see anything immediate (though this renders the name "singsub" for the array somewhat nonsensical). The stuff on line 144 came from this change: +2000-08-02 Sven Wischnowsky + + * 12475: Completion/Base/_arguments: prefer user-defined specs + over ones derived from --help output + I'm guessing that code should have looked for a ":" in $tmpargv and only treat as specs, those positions that follow either the ":" or that follow any option letter that can't appear to the left of a ":". I haven't run it down to this level, but it's possible that code pre-dates _arguments having any switches of its own. E.g. _arguments -s -w -q -s -- and _arguments -s -w : -q -s -- are equivalent becaue of the -q (even though I'd hope no one wrote the former in an actual completion function). Which I think is what your patch accomplishes (the -s and -w would be gobbled up and then the loop ends at either the ":" or the -q whichever comes first).