zsh-workers
 help / color / mirror / code / Atom feed
* Doc fix for :s/l/r/ modifier
@ 1995-07-07 22:18 Thorsten Meinecke
  1995-07-10 18:55 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Meinecke @ 1995-07-07 22:18 UTC (permalink / raw)
  To: zsh-workers

Since aeons, it seems to be perfectly legal to use the :s/l/r/ modifier
with history expansion. It may be just a funny way to write ^l^r, but
it can do much more.
The man page still says it only works with filename and parameter
expansion. This clarifies that a bit.

Since aeons, the error message for `!:s//r/' (and no previous match) is:

    zsh: no previous substitution with &

This is at least confusing for the casual user.


diff -c Doc/zshexpn.1.orig Doc/zshexpn.1
*** Doc/zshexpn.1.orig	Sat Jul  1 00:07:50 1995
--- Doc/zshexpn.1	Fri Jul  7 23:21:13 1995
***************
*** 827,834 ****
  .TP
  .B f
  Repeats the immediately (without a colon) following modifier until the
! resulting word doesn't change any more. This one and the following
! four only work with parameter and filename expansion.
  .TP
  .B F:\fIexpr\fB:
  Like \fBf\fP, but repeats only \fIn\fP times if the expression
--- 827,835 ----
  .TP
  .B f
  Repeats the immediately (without a colon) following modifier until the
! resulting word doesn't change any more. This and the following
! \fBF\fP, \fBw\fP and \fBW\fP modifier only work with parameter and
! filename expansion.
  .TP
  .B F:\fIexpr\fB:
  Like \fBf\fP, but repeats only \fIn\fP times if the expression
diff -c Src/hist.c.orig Src/hist.c
*** Src/hist.c.orig	Fri Jul  7 23:23:56 1995
--- Src/hist.c	Fri Jul  7 23:24:23 1995
***************
*** 356,362 ****
  		    subst(&sline, hsubl, hsubr, gbal);
  		else {
  		    herrflush();
! 		    zerr("no previous substitution with &", NULL, 0);
  		    habort();
  		}
  		break;
--- 356,362 ----
  		    subst(&sline, hsubl, hsubr, gbal);
  		else {
  		    herrflush();
! 		    zerr("no previous substitution", NULL, 0);
  		    habort();
  		}
  		break;

-- 
Thorsten Meinecke
<kaefer@aglaia.snafu.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Doc fix for :s/l/r/ modifier
  1995-07-07 22:18 Doc fix for :s/l/r/ modifier Thorsten Meinecke
@ 1995-07-10 18:55 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1995-07-10 18:55 UTC (permalink / raw)
  To: Thorsten Meinecke

Thorsten Meinecke wrote:
> Since aeons, the error message for `!:s//r/' (and no previous match) is:
> 
>     zsh: no previous substitution with &
> 
> This is at least confusing for the casual user.

If this substitution gives an error, then the parameter modifier sould also
give error. Here is a patch for that. It depends on my previous patch for
:s//r/ (art. 176).

Zoltan

*** 1.13	1995/07/07 15:59:57
--- Src/subst.c	1995/07/10 17:51:04
***************
*** 1476,1485 ****
  		    zsfree(hsubl);
  		    hsubl = ztrdup(ptr1);
  		}
! 		if (hsubl)
! 		    for (tt = hsubl; *tt; tt++)
! 			if (INULL(*tt))
! 			    chuck(tt);
  		for (tt = hsubr = ztrdup(ptr2); *tt; tt++)
  		    if (INULL(*tt))
  			chuck(tt);
--- 1476,1488 ----
  		    zsfree(hsubl);
  		    hsubl = ztrdup(ptr1);
  		}
! 		if (!hsubl) {
! 		    zerr("no previous substitution", NULL, 0);
! 		    return;
! 		}
! 		for (tt = hsubl; *tt; tt++)
! 		    if (INULL(*tt))
! 			chuck(tt);
  		for (tt = hsubr = ztrdup(ptr2); *tt; tt++)
  		    if (INULL(*tt))
  			chuck(tt);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-07-10 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-07-07 22:18 Doc fix for :s/l/r/ modifier Thorsten Meinecke
1995-07-10 18:55 ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).