summary refs log tree commit diff
path: root/Doc/Zsh
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-01 09:55:04 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-01 09:55:04 +0100
commit0e797d79ce0af34f20ec5fa86a4ed92554a968f9 (patch)
treebdc4b89861ae89bc0ddc16539566b8173ae88a65 /Doc/Zsh
parentbf258a1c07a9cf1119f83d1d15310b02b94f4d67 (diff)
downloadzsh-0e797d79ce0af34f20ec5fa86a4ed92554a968f9.tar.gz
zsh-0e797d79ce0af34f20ec5fa86a4ed92554a968f9.tar.xz
zsh-0e797d79ce0af34f20ec5fa86a4ed92554a968f9.zip
35007: Note in doc about scope of ZLE parameters
Diffstat (limited to 'Doc/Zsh')
-rw-r--r--Doc/Zsh/zle.yo15
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index ffce54c84..653678eba 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -743,6 +743,21 @@ local scope, like parameters created in a function using tt(local).
 Inside completion widgets and traps called while ZLE is active, these
 parameters are available read-only.
 
+Note that the parameters appear as local to any ZLE widget in
+which they appear.  Hence if it is desired to override them this needs
+to be done within a nested function:
+
+example(widget-function+LPAR()+RPAR() {
+  # $WIDGET here refers to the special variable
+  # that is local inside widget-function
+  +LPAR()+RPAR() {
+     # This anonymous nested function allows WIDGET
+     # to be used as a local variable.  The -h
+     # removes the special status of the variable.
+     local -h WIDGET
+  }
+})
+
 startitem()
 vindex(BUFFER)
 item(tt(BUFFER) (scalar))(