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=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2818 invoked from network); 24 May 2020 22:03:42 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 24 May 2020 22:03:42 -0000 Received: (qmail 19634 invoked by alias); 24 May 2020 22:03:30 -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: 45909 Received: (qmail 13636 invoked by uid 1010); 24 May 2020 22:03:29 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f54.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25821. spamassassin: 3.4.4. Clear:RC:0(209.85.210.54):SA:0(-1.9/5.0):. Processed in 1.800104 secs); 24 May 2020 22:03:29 -0000 X-Envelope-From: schaefer@brasslantern.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.210.54 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=gyvVzdUylgonnOwp82sxtwqETt49Y4vf3gL3vXPLv14=; b=s7wWuuVH23gbauO9IpVr3Egd5VYJH6M2xdvNnl4HNxibFghvJHekltfjYEHkzi/CSH 8uzlSYcvhJ85t+dJGjZ/2QwJUawMEWUVTZRnwmXyF0nv6DMAcwRn/em1x7KB/lT3amYy /8BuWBxy5XU5bZEGPKO86kqEyJszSGG3uLJG10fM2gPj/pIZcS3BLpeZywii1Z7zCdQC NRokNb/erfkmqAcBppW7g3hMpZQYrH8+Lhjg5A2b2O9Tqu3DjQaTAL2jRMCGPu5p+HKj Z8o8KXAOscXnmSZcH9r2gVdxKtQaoQ/j8D0AoaLpQEOxqTqqpUb6eWbzlcFUMYiQcS4P UgpQ== X-Gm-Message-State: AOAM533iVeeIGOYmC49caoPFoDReSXlQAa4SXf+SYRLHeK81aHwvM9L9 wTx4IX6ipjxzF1F3OL3+Kq8N+akvMDoP6cNPWSHPiEpiYvPP/g== X-Google-Smtp-Source: ABdhPJz/wnG2JSUpcQKyVCpE45wC82A70td64f7XEG8ScwxqdDxAnBs+eLvOyIy6GRT4/0dFaRC08ZHr1B1x2WYxICQ= X-Received: by 2002:a9d:7e8e:: with SMTP id m14mr19954110otp.229.1590357774573; Sun, 24 May 2020 15:02:54 -0700 (PDT) MIME-Version: 1.0 References: <20200523022807.08f3ba45@tarpaulin.shahaf.local2> In-Reply-To: From: Bart Schaefer Date: Sun, 24 May 2020 15:02:43 -0700 Message-ID: Subject: _arguments optspecs (was Re: Editing the history in the shell) To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On Sat, May 23, 2020 at 2:30 PM Bart Schaefer wrote: > > I'm not entirely sure about some > of the _zed optspecs, but all the desired combinations seem to work > and all the undesired ones seem not to. My uncertainty is around these three lines: > '(- 2):file:_files' \ > + '(-f -x 1)-h[edit history]:history file:_files' \ > + '2:history size: ';; The first spec causes "file" to be offered (as the first non-option argument) if there is no option yet, and will not offer a second argument. The second spec offers -h followed by "history file" as the argument to -h, and won't offer -f or -x or a first non-option argument. The third spec expects "history size" as the second non-option argument, but does not provide any completions. What's strange is why "history size" is the second non-option argument. If I leave (1) out of the exclusion list on the second spec, I get offered "file", so in that case the argument to -h is being taken as an option argument; but after filling in that position I next get "no more arguments" instead of "history files". So it appears that sometimes the argument of -h is not counted as a non-option argument, and other times it is so counted, which is why it's "2:" in the third optspec and the (1) is required in the second optspec. Does anybody actually understand this? Is it explainable (or already explained, where?) in the doc for _arguments?