about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Doc/Zsh/zle.yo6
-rw-r--r--Functions/Chpwd/zsh_directory_name_cdr5
-rw-r--r--Src/Zle/zle_main.c8
4 files changed, 17 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index a003eeac9..6e83c53c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-25  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 43084: Doc/Zsh/zle.yo, Functions/Chpwd/zsh_directory_name_cdr,
+	Src/Zle/zle_main.c: vared -g suppresses variable creation and
+	override warnings; also suppress in function.
+
 2018-06-25  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* 43079, 43086: Completion/Unix/Type/_process_names,
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index bd0252f6e..b72606c0b 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -342,7 +342,7 @@ findex(vared)
 cindex(parameters, editing)
 cindex(editing parameters)
 redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi(      )))
-xitem(tt(vared )[ tt(-Aache) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ])
+xitem(tt(vared )[ tt(-Aacghe) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ])
 xitem(SPACES()[ tt(-M) var(main-keymap) ] [ tt(-m) var(vicmd-keymap) ])
 xitem(SPACES()[ tt(-i) var(init-widget) ] [ tt(-f) var(finish-widget) ])
 item(SPACES()[ tt(-t) var(tty) ] var(name))(
@@ -353,7 +353,9 @@ When the tt(-c) flag is given, the parameter is created if it doesn't
 already exist.  The tt(-a) flag may be given with tt(-c) to create
 an array parameter, or the tt(-A) flag to create an associative array.
 If the type of an existing parameter does not match the type to be
-created, the parameter is unset and recreated.
+created, the parameter is unset and recreated.  The tt(-g) flag may
+be given to suppress warnings from the tt(WARN_CREATE_GLOBAL)
+and tt(WARN_NESTED_VAR) options.
 
 If an array or array slice is being edited, separator characters as defined
 in tt($IFS) will be shown quoted with a backslash, as will backslashes
diff --git a/Functions/Chpwd/zsh_directory_name_cdr b/Functions/Chpwd/zsh_directory_name_cdr
index c9be7db0c..cb72e4600 100644
--- a/Functions/Chpwd/zsh_directory_name_cdr
+++ b/Functions/Chpwd/zsh_directory_name_cdr
@@ -1,14 +1,13 @@
 if [[ $1 = n ]]; then
   if [[ $2 = <-> ]]; then
     # Recent directory
-    typeset -ga reply
     autoload -Uz cdr
     cdr -r
     if [[ -n ${reply[$2]} ]]; then
-      reply=(${reply[$2]})
+      typeset -ga reply=(${reply[$2]})
       return 0
     else
-      reply=()
+      typeset -ga reply=()
       return 1
     fi
   fi
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index b78c47eed..99e44a744 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1652,6 +1652,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
     Param pm = 0;
     int ifl;
     int type = PM_SCALAR, obreaks = breaks, haso = 0, oSHTTY = 0;
+    int warn_flags;
     char *p1, *p2, *main_keymapname, *vicmd_keymapname, *init, *finish;
     Keymap main_keymapsave = NULL, vicmd_keymapsave = NULL;
     FILE *oshout = NULL;
@@ -1665,6 +1666,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
 	return 1;
     }
 
+    warn_flags = OPT_ISSET(ops, 'g') ? 0 : ASSPM_WARN;
     if (OPT_ISSET(ops,'A'))
     {
 	if (OPT_ISSET(ops, 'a'))
@@ -1845,11 +1847,11 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
 	a = spacesplit(t, 1, 0, 1);
 	zsfree(t);
 	if (PM_TYPE(pm->node.flags) == PM_ARRAY)
-	    setaparam(args[0], a);
+	    assignaparam(args[0], a, warn_flags);
 	else
 	    sethparam(args[0], a);
     } else
-	setsparam(args[0], t);
+	assignsparam(args[0], t, warn_flags);
     unqueue_signals();
     return 0;
 }
@@ -2148,7 +2150,7 @@ zle_main_entry(int cmd, va_list ap)
 
 static struct builtin bintab[] = {
     BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL),
-    BUILTIN("vared",   0, bin_vared,   1,  1, 0, "aAcef:hi:M:m:p:r:t:", NULL),
+    BUILTIN("vared",   0, bin_vared,   1,  1, 0, "aAcef:ghi:M:m:p:r:t:", NULL),
     BUILTIN("zle",     0, bin_zle,     0, -1, 0, "aAcCDfFgGIKlLmMNrRTUw", NULL),
 };