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

Re: problem redeclaring path variable (ksh incompatibility)



On Mar 17,  4:50pm, Bart Schaefer wrote:
}
} If we were going to attempt to change this, the right way would be to add
} a new option, perhaps called LOCAL_SPECIALS, which would be on by default.
} "emulate sh" et al. would unset this option.  When NO_LOCAL_SPECIALS, the
} typeset builtin would behave as if the -h option were always present.
} 
} Other, less desirable approaches might be to tie this behavior to the
} POSIX_BUILTINS or KSH_TYPESET options.  Possibly it should be tied to
} KSH_TYPESET even if LOCAL_SPECIALS is added.

Here's a short patch that illustrates how this would work.  With this
patch applied, Michael's function works as he expects, and "typeset +h"
can be used to force a special to remain locally special.

Index: builtin.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/builtin.c,v
retrieving revision 1.30
diff -c -r1.30 builtin.c
--- builtin.c	18 Feb 2005 17:05:15 -0000	1.30
+++ builtin.c	17 Mar 2005 17:23:35 -0000
@@ -2236,6 +2236,9 @@
     if (on & PM_TIED)
 	off |= PM_INTEGER | PM_EFLOAT | PM_FFLOAT | PM_ARRAY | PM_HASHED;
 
+    if (isset(KSHTYPESET))
+	on |= PM_HIDE;
+
     on &= ~off;
 
     queue_signals();



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