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 b2a477f6 for ; Tue, 2 Apr 2019 03:14:00 +0000 (UTC) Received: (qmail 9906 invoked by alias); 2 Apr 2019 03:13:50 -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: 44202 Received: (qmail 19208 invoked by uid 1010); 2 Apr 2019 03:13:50 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.1/25405. spamassassin: 3.4.2. Clear:RC:0(209.85.210.53):SA:0(-1.8/5.0):. Processed in 2.061333 secs); 02 Apr 2019 03:13:50 -0000 X-Envelope-From: phy1729@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.210.53 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=cY5WuYCNaE5z0qrL3MVjv/sLQcQ9t5JWVjtg15B7zK4=; b=QyR6r+/d2qeNxtT8RHPTtYwmTRdOXQZgELLMgMM+8eGDlGQKCGno/gxVP1ayXcfVjI wl08chHdWfCJAdTJPUS5Wd4cw01yzEQfRT4lE5RiZNd7e1CMzNrqWydOtBa1WSywYLoQ /WC4A9QvQ1l13WlwzHwYra4Brv/yn6M9j2BJjCA/TPDV5lx7z2AQawo0AeZQRT4OujlR xEAZQKaC6IkogFw9grvTcgd6nuYDg4j2Cf4l2bIqf6xZZhsUHW/g5oD5QQZUF5JdosZ/ SDd2aJMbwc7sD8qdSdwfE5clEsQzBWikf2fcnN1vLAqVhkoknra/RhvxO2fcl5eRwWv9 6QUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:user-agent; bh=cY5WuYCNaE5z0qrL3MVjv/sLQcQ9t5JWVjtg15B7zK4=; b=QbJb/E/ZAxf+dTU9f9Q2GuzrMbYi2C2TpB5BafbpsT1WxY4kAFAYL5YGcM8OcjM9jW JYiS0XU3cLO5XVbBcsCbErxUKQvip3gQsIjk03agf+C3UWS/iwfBd+GsYuG94c1MEJlJ y8OmC4/yFIU1QfIT0AfrEj+9fLN/1k2iANVyZqcebl1QsEvJdUIYpJpFRkSYunVANAlQ Jk2g2nNotPJMM7UWnZIrzOXaX5NkPCvPO2MWR5lKLbqn50Pe/0r0YHokXYpW13s/AY1n w3DyIUIVXQabwUrvdBvz2apRv4NG3pUtHuXsoPeEUKAhznqgtFhbqKRwYklRxXoNQtrt HGEQ== X-Gm-Message-State: APjAAAUZ7FIZI5xWjwXIpBXB1dMwUgeBcv0P5h/IFFxJW/pa5jydYevY U8edCwkwV/VuwXq0ZRjxAp+J2frJXlo= X-Google-Smtp-Source: APXvYqzk4pM2bdbrvXC31t0q6aYG1GoewsmQXVAiZfZXIVApC+Ittnv8uUHk/op1Jl4at7k5EuFcrw== X-Received: by 2002:a05:6830:154e:: with SMTP id l14mr45062805otp.269.1554174795553; Mon, 01 Apr 2019 20:13:15 -0700 (PDT) Date: Mon, 1 Apr 2019 22:13:13 -0500 From: Matthew Martin To: zsh-workers@zsh.org Subject: [PATCH 4/4] _normal: Add -P to reset precommands Message-ID: <20190402031310.GA60178@CptOrmolo.darkstar> Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.11.4 (2019-03-13) Add the ability to reset the precommands array to empty. Will be useful for zsh -c and perhaps some other situations. Again the texi is cargo-culted. --- Completion/Base/Core/_normal | 3 ++- Doc/Zsh/compsys.yo | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Completion/Base/Core/_normal b/Completion/Base/Core/_normal index 7732837ac..0d84eae87 100644 --- a/Completion/Base/Core/_normal +++ b/Completion/Base/Core/_normal @@ -3,8 +3,9 @@ local _comp_command1 _comp_command2 _comp_command precommand local -A opts -zparseopts -A opts -D - p+:-=precommand s +zparseopts -A opts -D - P p+:-=precommand s (( $+opts[-s] )) || _compskip= +(( $+opts[-P] )) && precommands=() (( $#precommand )) && precommands+=(${precommand#-p}) # Check for a history reference to complete modifiers. diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index af47f1fdb..f3f32db1e 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -4658,7 +4658,7 @@ fi return ret) ) findex(_normal) -xitem(tt(_normal) [ tt(-p) var(precommand) ])( +xitem(tt(_normal) [ tt(-P) | tt(-p) var(precommand) ])( This is the standard function called to handle completion outside any special tt(-)var(context)tt(-). It is called both to complete the command word and also the arguments for a command. In the second case, @@ -4674,9 +4674,14 @@ then calls `tt(_normal) tt(-p) tt($service)'. The effect is that `tt(nohup) var(cmd ...)' is treated in the same way as `var(cmd ...)'. startitem() +item(tt(-P))( +Reset the list of precommands. Should be used if completing a command +line which allows internal commands (e.g. builtins and functions) +regardless of prior precommands (e.g. `tt(zsh) tt(-c)'). +) item(tt(-p) var(precommand))( Append var(precommand) to the list of precommands. Should be used in -nearly all cases. +nearly all cases in which tt(-P) is not applicable. ) enditem() -- 2.21.0