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

Re: `typeset -H' is a bit too thorough



> There needs to be some way to get the value to display without actually
> turning off the HIDEVAL bit.  E.g., perhaps HIDEVAL should not apply to
> parameters named explicitly as arguments of typeset?

(Still not getting incoming mail here, unfortunately, which means getting
message from the archive and stripping off the HTML.  It would be useful to
be able to get individual messages in plain text, e.g. as an option on the
HTML display.)

The easiest fix is to turn this off whenever the parameter is referred to
by name or by pattern.  I'm not sure if that's the right thing to do with
patterns, but that's always behaved just as if the parameter was picked by
name, so I suppose it's OK.

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.10
diff -u -r1.10 builtins.yo
--- Doc/Zsh/builtins.yo	2000/06/09 15:37:05	1.10
+++ Doc/Zsh/builtins.yo	2000/06/12 09:16:33
@@ -1132,9 +1132,11 @@
 Hide value: specifies that tt(typeset) will not display the value of the
 parameter when listing parameters; the display for such parameters is
 always as if the `tt(PLUS())' flag had been given.  Use of the parameter is
-in other respects normal.  This is on by default for the parameters in the
-tt(zsh/parameter) and tt(zsh/mapfile) modules.  Note, however, that unlike
-the tt(-h) flag this is also useful for non-special parameters.
+in other respects normal, and the option does not apply if the parameter is
+specified by name, or by pattern with the tt(-m) option.  This is on by
+default for the parameters in the tt(zsh/parameter) and tt(zsh/mapfile)
+modules.  Note, however, that unlike the tt(-h) flag this is also useful
+for non-special parameters.
 )
 item(tt(-i))(
 Use an internal integer representation.  If var(n) is nonzero it
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.22
diff -u -r1.22 builtin.c
--- Src/builtin.c	2000/06/09 15:37:05	1.22
+++ Src/builtin.c	2000/06/12 09:16:33
@@ -1598,7 +1598,7 @@
     if (usepm) {
 	on &= ~PM_LOCAL;
 	if (!on && !roff && !value) {
-	    paramtab->printnode((HashNode)pm, 0);
+	    paramtab->printnode((HashNode)pm, PRINT_INCLUDEVALUE);
 	    return pm;
 	}
 	if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.18
diff -u -r1.18 params.c
--- Src/params.c	2000/06/09 15:37:05	1.18
+++ Src/params.c	2000/06/12 09:16:33
@@ -3181,7 +3181,8 @@
 	    printf("exported ");
     }
 
-    if ((printflags & PRINT_NAMEONLY) || (p->flags & PM_HIDEVAL)) {
+    if ((printflags & PRINT_NAMEONLY) ||
+	((p->flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) {
 	zputs(p->nam, stdout);
 	putchar('\n');
 	return;
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.13
diff -u -r1.13 zsh.h
--- Src/zsh.h	2000/06/09 15:37:05	1.13
+++ Src/zsh.h	2000/06/12 09:16:33
@@ -1213,6 +1213,7 @@
 #define PRINT_TYPE		(1<<1)
 #define PRINT_LIST		(1<<2)
 #define PRINT_KV_PAIR		(1<<3)
+#define PRINT_INCLUDEVALUE	(1<<4)
 
 /* flags for printing for the whence builtin */
 #define PRINT_WHENCE_CSH	(1<<4)

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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