summaryrefslogtreecommitdiff
path: root/Doc/Zsh/options.yo
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/Zsh/options.yo')
-rw-r--r--Doc/Zsh/options.yo75
1 files changed, 71 insertions, 4 deletions
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index f68a945ec..70092d681 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -395,8 +395,9 @@ pindex(RECEXACT)
pindex(NORECEXACT)
cindex(completion, exact matches)
item(tt(REC_EXACT) (tt(-S)))(
-In completion, recognize exact matches even
-if they are ambiguous.
+If the string on the command line exactly matches one of the possible
+completions, it is accepted, even if there is another completion (i.e. that
+string with something else added) that also matches.
)
enditem()
@@ -722,9 +723,10 @@ pindex(REMATCHPCRE)
pindex(NOREMATCHPCRE)
cindex(regexp, PCRE)
cindex(PCRE, regexp)
-item(tt(REMATCH_PCRE) <Z>)(
+item(tt(REMATCH_PCRE))(
If set, regular expression matching with the tt(=~) operator will use
-Perl-Compatible Regular Expressions from the PCRE library, if available.
+Perl-Compatible Regular Expressions from the PCRE library.
+(The tt(zsh/pcre) module must be available.)
If not set, regular expressions will use the extended regexp syntax
provided by the system libraries.
)
@@ -768,6 +770,37 @@ global from within a function using tt(typeset -g) do not cause a warning.
Note that there is no warning when a local parameter is assigned to in
a nested function, which may also indicate an error.
)
+pindex(WARN_NESTED_VAR)
+pindex(NO_WARN_NESTED_VAR)
+pindex(WARNNESTEDVAR)
+pindex(NO_WARNNESTEDVAR)
+cindex(parameters, warning when setting in enclosing scope)
+item(tt(WARN_NESTED_VAR))(
+Print a warning message when an existing parameter from an
+enclosing function scope, or global, is set in a function
+by an assignment or in math context. Assignment to shell
+special parameters does not cause a warning. This is the companion
+to tt(WARN_CREATE_GLOBAL) as in this case the warning is only
+printed when a parameter is em(not) created. Where possible,
+use of tt(typeset -g) to set the parameter suppresses the error,
+but note that this needs to be used every time the parameter is set.
+To restrict the effect of this option to a single function scope,
+use `tt(functions -W)'.
+
+For example, the following code produces a warning for the assignment
+inside the function tt(nested) as that overrides the value within
+tt(toplevel)
+
+example(toplevel+LPAR()RPAR() {
+ local foo="in fn"
+ nested
+}
+nested+LPAR()RPAR() {
+ foo="in nested"
+}
+setopt warn_nested_var
+toplevel)
+)
enditem()
subsect(History)
@@ -1539,6 +1572,36 @@ enditem()
subsect(Scripts and Functions)
startitem()
+pindex(ALIAS_FUNC_DEF)
+pindex(NO_ALIAS_FUNC_DEF)
+pindex(ALIASFUNCDEF)
+pindex(NOALIASFUNCDEF)
+cindex(functions, defining with expanded aliases)
+cindex(aliases, expanding in function definition)
+item(tt(ALIAS_FUNC_DEF) <S>)(
+By default, zsh does not allow the definition of functions using
+the `var(name) tt(LPAR()RPAR())' syntax if var(name) was expanded as an
+alias: this causes an error. This is usually the desired behaviour, as
+otherwise the combination of an alias and a function based on the same
+definition can easily cause problems.
+
+When this option is set, aliases can be used for defining functions.
+
+For example, consider the following definitions as they might
+occur in a startup file.
+
+example(alias foo=bar
+foo+LPAR()RPAR() {
+ print This probably does not do what you expect.
+})
+
+Here, tt(foo) is expanded as an alias to tt(bar) before the
+tt(LPAR()RPAR()) is encountered, so the function defined would be named
+tt(bar). By default this is instead an error in native mode. Note that
+quoting any part of the function name, or using the keyword
+tt(function), avoids the problem, so is recommended when the function
+name can also be an alias.
+)
pindex(C_BASES)
pindex(NO_C_BASES)
pindex(CBASES)
@@ -2077,6 +2140,10 @@ In addition, various error conditions associated with the above builtins
or tt(exec) cause a non-interactive shell to exit and an interactive
shell to return to its top-level processing.
+Furthermore, functions and shell builtins are not executed after
+an tt(exec) prefix; the command to be executed must be an external
+command found in the path.
+
Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
fashion in that the associated variable tt(OPTIND) is not made
local to functions.