about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Core/_normal3
-rw-r--r--Doc/Zsh/compsys.yo9
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f960e85ae..c2694ed3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-04-04  Matthew Martin  <phy1729@gmail.com>
 
+	* 44202 (tweaked): Completion/Base/Core/_normal,
+	Doc/Zsh/compsys.yo: Add -P to reset precommands.
+
 	* 44201: Completion/Base/Core/_main_complete,
 	Completion/Base/Utility/_pick_variant,
 	Completion/Linux/Command/_setsid,
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 f0fdbf293..8b00517b7 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -4658,7 +4658,7 @@ fi
 return ret)
 )
 findex(_normal)
-item(tt(_normal) [ tt(-p) var(precommand) ])(
+item(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 -p $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. This option 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 -c)').
+)
 item(tt(-p) var(precommand))(
 Append var(precommand) to the list of precommands. This option should be
-used in nearly all cases.
+used in nearly all cases in which tt(-P) is not applicable.
 )
 enditem()