summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3db846c4b..33d8ac4c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
 	* unposted: Config/version.mk, Src/parse.c, Src/Zle/zle_misc.c:
 	update to 5.0.8-test-2 and fix some exports.
 
+2015-08-21  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 36256: Src/builtin.c: local options should remain in effect
+	for "emulate -L" even if additional option settings are applied
+
 2015-08-21  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 36264: Src/glob.c: pathbuf is apparently metafied; document
diff --git a/Src/builtin.c b/Src/builtin.c
index 3d34aa74c..97022addf 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5465,8 +5465,8 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
 
     /* with single argument set current emulation */
     if (!argv[1]) {
-	emulate(shname, OPT_ISSET(ops,'R'), &emulation, opts);
-	if (OPT_ISSET(ops,'L'))
+	emulate(shname, opt_R, &emulation, opts);
+	if (opt_L)
 	    opts[LOCALOPTIONS] = opts[LOCALTRAPS] = opts[LOCALPATTERNS] = 1;
 	clearpatterndisables();
 	return 0;
@@ -5476,7 +5476,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
     memcpy(saveopts, opts, sizeof(opts));
     memcpy(new_opts, opts, sizeof(opts));
     savehackchar = keyboardhackchar;
-    emulate(shname, OPT_ISSET(ops,'R'), &new_emulation, new_opts);
+    emulate(shname, opt_R, &new_emulation, new_opts);
     optlist = newlinklist();
     if (parseopts("emulate", &argv, new_opts, &cmd, optlist)) {
 	ret = 1;
@@ -5508,8 +5508,11 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
 	    goto restore2;
 	}
 	*--argv = cmd;	/* on stack, never free()d, see execbuiltin() */
-    } else
+    } else {
+	if (opt_L)
+	    opts[LOCALOPTIONS] = opts[LOCALTRAPS] = opts[LOCALPATTERNS] = 1;
 	return 0;
+    }
 
     save_sticky = sticky;
     sticky = hcalloc(sizeof(*sticky));