From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu
Subject: Re: History !# substitutions
Date: Wed, 29 May 1996 10:19:06 +0200 [thread overview]
Message-ID: <199605290819.KAA06804@hydra.ifh.de> (raw)
In-Reply-To: "schaefer@candle.brasslantern.com"'s message of "Tue, 28 May 1996 22:33:03 MET." <960528223307.ZM2584@candle.brasslantern.com>
> The !# substitution, which shuffles words from the current command line,
> has always been a bit flaky in zsh, but now it seems to be broken entirely.
>
> zagzig% echo foo bar !#:1
> zsh: no words available from current command
Profuse apologies: this no doubt came in why I upgraded the
word-selection part of the history mechanism and didn't know enough
about !# to make it work.
The following seems to do the trick; do let me know of unforeseen
behaviour. (I've deleted that particular error message since `no such
word in event' seems to describe the remaining occasions when there is
an error entirely adequately.) I hope flakiness can now be avoided
entirely.
*** Src/hist.c.curhist Fri May 10 22:22:30 1996
--- Src/hist.c Wed May 29 10:12:15 1996
***************
*** 1111,1131 ****
getargs(Histent elist, int arg1, int arg2)
{
char *ret;
! int pos1;
! if (arg1 >= elist->nwords || arg2 >= elist->nwords) {
/* remember, argN is indexed from 0, nwords is total no. of words */
inerrflush();
! if (!elist->nwords)
! zerr("no words available from current command", NULL, 0);
! else
! zerr("no such word in event", NULL, 0);
return NULL;
}
! pos1 = elist->words[2*arg1];
ret = dupstring(elist->text + pos1);
! ret[elist->words[2*arg2+1] - pos1] = '\0';
return ret;
}
--- 1111,1137 ----
getargs(Histent elist, int arg1, int arg2)
{
char *ret;
! short *words;
! int pos1, nwords;
! if (elist == curhistent) {
! words = chwords;
! nwords = chwordpos/2;
! } else {
! words = elist->words;
! nwords = elist->nwords;
! }
!
! if (arg1 >= nwords || arg2 >= nwords) {
/* remember, argN is indexed from 0, nwords is total no. of words */
inerrflush();
! zerr("no such word in event", NULL, 0);
return NULL;
}
! pos1 = words[2*arg1];
ret = dupstring(elist->text + pos1);
! ret[words[2*arg2+1] - pos1] = '\0';
return ret;
}
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
next prev parent reply other threads:[~1996-05-29 8:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-05-29 5:33 Bart Schaefer
1996-05-29 8:19 ` Peter Stephenson [this message]
1996-05-29 15:20 ` Peter Stephenson
1996-05-30 4:40 ` Bart Schaefer
1996-05-30 8:33 ` Peter Stephenson
1996-05-30 14:58 ` Bart Schaefer
1996-05-30 15:11 ` Zefram
1996-05-30 16:11 ` Barton E. Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199605290819.KAA06804@hydra.ifh.de \
--to=pws@ifh.de \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).