about summary refs log tree commit diff
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
parentbf258a1c07a9cf1119f83d1d15310b02b94f4d67 (diff)
downloadzsh-0e797d79ce0af34f20ec5fa86a4ed92554a968f9.tar.gz
zsh-0e797d79ce0af34f20ec5fa86a4ed92554a968f9.tar.xz
zsh-0e797d79ce0af34f20ec5fa86a4ed92554a968f9.zip
35007: Note in doc about scope of ZLE parameters
-rw-r--r--ChangeLog4
-rw-r--r--Doc/Zsh/zle.yo15
2 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d2fb1b5a..0f563bd92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-01  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 35007: Doc/Zsh/zle.yo: note about scope of ZLE parameters.
+
 2015-04-29  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 34992: Doc/Zsh/builtins.yo, Src/builtin.c, Src/params.c,
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))(