Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: pws-N: emulate -L makes traps local



The other message still sitting around in limbo sent this patch which makes
emulate -L turn on local traps, too, as well as setting the options
directly, since dosetopt() is overkill if you know what the option is.


--- Doc/Zsh/builtins.yo.lt3	Mon Jun 21 09:28:19 1999
+++ Doc/Zsh/builtins.yo	Tue Jun 22 17:38:17 1999
@@ -224,10 +224,11 @@
 mode, except for certain options describing the interactive
 environment; otherwise, only those options likely to cause portability
 problems in scripts and functions are altered.  If the tt(-L) option
-is given, the option tt(LOCAL_OPTIONS) will be set as well, causing
-the effect of the tt(emulate) command to be local to the immediately
-surrounding shell function, if any; normally this is turned off in all
-emulation modes except tt(ksh).
+is given, the options tt(LOCAL_OPTIONS) and tt(LOCAL_TRAPS) will be set as
+well, causing the effects of the tt(emulate) command and any tt(setopt) and
+tt(trap) commands to be local to the immediately surrounding shell
+function, if any; normally these options are turned off in all emulation
+modes except tt(ksh).
 )
 findex(enable)
 cindex(enabling commands)
--- Src/builtin.c.lt3	Sun Jun 20 14:36:17 1999
+++ Src/builtin.c	Tue Jun 22 17:36:18 1999
@@ -3074,7 +3074,7 @@
 {
     emulate(*argv, ops['R']);
     if (ops['L'])
-	dosetopt(LOCALOPTIONS, 1, 0);
+	opts[LOCALOPTIONS] = opts[LOCALTRAPS] = 1;
     return 0;
 }
 
-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author