Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 4/4] _normal: Add -P to reset precommands
- X-seq: zsh-workers 44202
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 4/4] _normal: Add -P to reset precommands
- Date: Mon, 1 Apr 2019 22:13:13 -0500
- 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==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author