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

\\! notes and fixes for hzoli10+



The patch below fixes two bugs in hzoli10+ versions.  The patch to builtin.c
fixes typeset -U. So far, `typeset -U foo' did not removed the duplicates from
foo only if the -U (UNIQUE) flag was already set for foo.  After this patch
the duplicates will be removed immediately by typeset -U foo.

The patch to hist.c adds a missing assignment which I left out when I merged
Peter's input patches (I hand-patched my changes there, and somehow I omitted
this).  This bug caused the

% echo \\!
zsh: Oops. You discovered a bug in hungetc

message.  Someone wrote that \\!$ should expand history.  I disagree here.
First it would further complicate the history expansion code.  And it would be
difficult to decide what is the correct behaviour: consider \!$, \\!$, \\\!$
etc.  Now in each case, how many backslashes should be in the result?  And
which bangs are quoted and which are unquoted?  E.g. one might say that in
\\\!$ the first backslash escapes the second, and the third escapes the bang,
so the expansion is just \!$.  But an other argument is that backslash only
escapes a backslash if the later escapes a bang. In that case the result would
be two backslash and !$ would be expanded as a history reference etc.  I think
the best is to live with the present behaviour (i.e. a backslash followed by a
bang always produces a single bang).  I know that with this method it is not
possible to put a backslash before a history-expanded word, but it is a quite
rare situation and it doesn't worth the effort.  Also tcsh treats single or
double quoted bangs in the same way so it is somewhat consistent with tcsh (I
know that without quotes \\!$ expands history in tcsh but I think that's
because tcsh doesn't separate history expansion from the rest of the code as
zsh does).

P.S.
During the weekend a lightning caused some severe damage in the network here
so the ftp site for my releases is temporarily unavailable.  It may take a few
days to fix the problem as everybody is on holiday now.

Bye,
  Zoltan


rcsdiff -qc -kk -r1.23 -r1.24 Src/builtin.c
*** Src/builtin.c
--- Src/builtin.c	1995/07/17 20:27:40
***************
*** 3043,3049 ****
  			/* set up the flags and, if required, the value */
  			if (PM_TYPE(pm->flags) == PM_ARRAY && (on & PM_UNIQUE) &&
  			    !(pm->flags & PM_READONLY & ~off))
! 			    (*pm->sets.afn) (pm, (*pm->gets.afn) (pm));
  			pm->flags = (pm->flags | on) & ~off;
  			if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER))
  			    && (PM_TYPE(pm->flags) != PM_ARRAY))
--- 3043,3049 ----
  			/* set up the flags and, if required, the value */
  			if (PM_TYPE(pm->flags) == PM_ARRAY && (on & PM_UNIQUE) &&
  			    !(pm->flags & PM_READONLY & ~off))
! 			    uniqarray((*pm->gets.afn) (pm));
  			pm->flags = (pm->flags | on) & ~off;
  			if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER))
  			    && (PM_TYPE(pm->flags) != PM_ARRAY))
***************
*** 3090,3096 ****
  		}
  		if (PM_TYPE(pm->flags) == PM_ARRAY && (on & PM_UNIQUE) &&
  		    !(pm->flags & PM_READONLY & ~off))
! 		    (*pm->sets.afn) (pm, (*pm->gets.afn) (pm));
  		pm->flags = (pm->flags | on) & ~off;
  		if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER))
  		    pm->ct = auxlen;
--- 3090,3096 ----
  		}
  		if (PM_TYPE(pm->flags) == PM_ARRAY && (on & PM_UNIQUE) &&
  		    !(pm->flags & PM_READONLY & ~off))
! 		    uniqarray((*pm->gets.afn) (pm));
  		pm->flags = (pm->flags | on) & ~off;
  		if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER))
  		    pm->ct = auxlen;
rcsdiff -qc -kk -r1.5 -r1.6 Src/hist.c
*** Src/hist.c
--- Src/hist.c	1995/07/17 22:00:18
***************
*** 522,527 ****
--- 522,528 ----
  	 * (unusual means unusual for a bang like a number).               */
  	doit = !stophist;
  	qbang = 0;
+ 	c = '\\';
  	goto escape;
      }
  }



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