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

PATCH: pws-whatever: emulate -L sets localtraps



Seems natural to me that emulate -L should extend the localisation
behaviour to traps as well as options.  This also gives an automatic upgrade
if you move from 3.0.6 to 3.1.6 or 4 or whatever.

Also, dosetopt() is overkill for setting the options; it's really intended
for a generic option number where you need to test for side effects.

--- 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