* Feature Request: HIST_STORE_BANG option
@ 1998-08-04 19:55 Matt Gerassimoff
1998-08-05 19:08 ` Bart Schaefer
1998-08-05 20:19 ` zsh on u/win on NT? Dave Yost
0 siblings, 2 replies; 6+ messages in thread
From: Matt Gerassimoff @ 1998-08-04 19:55 UTC (permalink / raw)
To: zsh-workers
Hey,
I have an idea for a feature I would like to see (if not already implemented).
I would like the ability to store the history substituion commands into the
history buffer instead of the substituded command. Alot of times I would like
to get back the substitution I used several commands ago but can't because
the actual command (after the substitution) is stored. Could a option be
implemented, HIST_STORE_BANG, that would store the command before the
substitution took place? ZSH is the hottest shell there is. There is none
other that compares.
Thanks,
Matt Gerassimoff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature Request: HIST_STORE_BANG option
1998-08-04 19:55 Feature Request: HIST_STORE_BANG option Matt Gerassimoff
@ 1998-08-05 19:08 ` Bart Schaefer
1998-08-05 20:19 ` zsh on u/win on NT? Dave Yost
1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 1998-08-05 19:08 UTC (permalink / raw)
To: Matt Gerassimoff, zsh-workers
On Aug 4, 2:55pm, Matt Gerassimoff wrote:
} Subject: Feature Request: HIST_STORE_BANG option
}
} Alot of times I would like to get back the substitution I used
} several commands ago but can't because the actual command (after
} the substitution) is stored. Could a option be implemented,
} HIST_STORE_BANG, that would store the command before the substitution
} took place?
This would be difficult because of the way history expansion takes place.
History is expanding during lexical analysis of the input; that is, at
the same time that the characters are being read. Zsh "pretends" that
what you typed was the text -after- history substitution. Consequently,
zsh never "sees" the entire unexpanded input.
Even if it could be implemented, the potential for confusion would be
very high. Consider:
zsh% echo This line is one.
This line is one.
zsh% !!:s/one/another/
echo This line is another.
This line is another.
zsh% !!
zsh: command not found: !!:s/one/another/
What should history references to unexpanded history references mean?
Expand a second time? What does the !! in the second expansion mean?
What you're really asking for is the ability to scroll back through the
line editor input as if it were distinct from the shell's command input.
(Zsh used to do something almost-but-not-quite like that, back when it
had options to distinguish "literal" from "lexical" history.) The best
way to implement that would not be a history option, but a modification
to ZLE itself, to store and fetch lines from the previous editor input
rather than from the history.
Here's a simple implementation of this using the zle widget facilities
of zsh 3.1.4. It lacks searching and other history facilities, but you
can scroll up and down just fine. Note that if you abort an edit with
^C or ^G, the scrollback position is left unchanged (is that a feature?).
--- 8< --- snip --- 8< ---
zle_hist=0
zle_lines=()
zle_store () {
zle_lines=($zle_lines $BUFFER)
((zle_hist=$#zle_lines+1))
zle accept-line
}
zle_fetch_previous () {
((zle_hist -= ${1:-1}))
if ((zle_hist > 0 && zle_hist <= $#zle_lines))
then
BUFFER=$zle_lines[$zle_hist]
else
if ((zle_hist == 0))
then
((zle_hist=1))
else
((zle_hist=$#zle_lines+1))
fi
echo -en '\a'
fi
}
zle_fetch_next () {
zle_fetch_previous -${1:-1}
}
zle -N zle_store zle_store
zle -N zle_fetch_next zle_fetch_next
zle -N zle_fetch_previous zle_fetch_previous
# If we bind this to ^M, then ^J can be used to avoid entering a line
# into the zle_lines history, and to accept-line in an emergency in
# case the zle_store function gets messed up somehow.
bindkey \^M zle_store
# Choose reasonable bindings for the following; ^P and ^N override the
# usual history up/down bindings (so I commented out these lines).
#bindkey \^P zle_fetch_previous
#bindkey \^N zle_fetch_next
--- 8< --- snip --- 8< ---
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* zsh on u/win on NT?
1998-08-04 19:55 Feature Request: HIST_STORE_BANG option Matt Gerassimoff
1998-08-05 19:08 ` Bart Schaefer
@ 1998-08-05 20:19 ` Dave Yost
1998-08-06 8:44 ` Zefram
1 sibling, 1 reply; 6+ messages in thread
From: Dave Yost @ 1998-08-05 20:19 UTC (permalink / raw)
To: zsh-workers
If you have to use NT, as I do, then it's nice to have a good unix emulation package.
One such package that is free for educational, research, and evaluation purposes is David Korn's U/WIN with the gnu compiler and development tools. It even does hard links and symbolic links. See
http://www.research.att.com/sw/tools/uwin/
I tried to bring up zsh on u/win and failed. It's not in the compilation, but in the stuff before that, which is pretty hairy, and I thought maybe there is someone on this list who knows that stuff pretty well and would be willing to take a shot. Imagine: a full-blown up-to-the-minute zsh along with the rest of the unix and gnu toolset to make Windows or NT more hospitable!
Thanks
Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: zsh on u/win on NT?
1998-08-05 20:19 ` zsh on u/win on NT? Dave Yost
@ 1998-08-06 8:44 ` Zefram
1998-08-06 16:34 ` Dave Yost
0 siblings, 1 reply; 6+ messages in thread
From: Zefram @ 1998-08-06 8:44 UTC (permalink / raw)
To: Dave Yost; +Cc: zsh-workers
Dave Yost wrote:
>I tried to bring up zsh on u/win and failed. It's not in the compilation, but in the stuff before that, which is pretty hairy,
Where is it failing?
-zefram
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: zsh on u/win on NT?
1998-08-06 8:44 ` Zefram
@ 1998-08-06 16:34 ` Dave Yost
1998-08-06 16:41 ` Zefram
0 siblings, 1 reply; 6+ messages in thread
From: Dave Yost @ 1998-08-06 16:34 UTC (permalink / raw)
To: Zefram; +Cc: zsh-workers
Zefram wrote:
> Dave Yost wrote:
> >I tried to bring up zsh on u/win and failed. It's not in the compilation, but in the stuff before that, which is pretty hairy,
>
> Where is it failing?
Well it's been a while since I last tried, so I'll have to go back and get back into it. Anyway, here are some changes I made to get 4.0.5 to compile. It would be great if someone would roll these changes or their equivalent into the current development version. Then maybe I should start fresh with that.
diff -rc ../a-3.0.5/Src/cond.c ./Src/cond.c
*** ../a-3.0.5/Src/cond.c Mon Mar 30 09:50:52 1998
--- ./Src/cond.c Mon Jun 02 22:11:26 1997
***************
*** 74,83 ****
return (S_ISREG(dostat(c->left)));
case 'g':
return (!!(dostat(c->left) & S_ISGID));
- #ifdef S_ISVTX
case 'k':
return (!!(dostat(c->left) & S_ISVTX));
- #endif
case 'n':
return (!!strlen(c->left));
case 'o':
--- 74,81 ----
diff -rc ../a-3.0.5/Src/exec.c ./Src/exec.c
*** ../a-3.0.5/Src/exec.c Mon Mar 30 12:32:21 1998
--- ./Src/exec.c Thu Sep 25 18:42:16 1997
***************
*** 1446,1456 ****
holdintr();
/* Check if we should run background jobs at a lower priority. */
if ((how & Z_ASYNC) && isset(BGNICE))
- #ifndef NO_NICE
nice(5);
- #else
- ;
- #endif
} else if (is_cursh) {
/* This is a current shell procedure that didn't need to fork. *
--- 1446,1452 ----
diff -rc ../a-3.0.5/Src/glob.c ./Src/glob.c
*** ../a-3.0.5/Src/glob.c Mon Mar 30 12:49:56 1998
--- ./Src/glob.c Thu Sep 25 18:42:16 1997
***************
*** 36,46 ****
{
char *us = unmeta(s);
! return access(us,0) == 0
! #ifndef NO_SYMLINKS
! || readlink(us,NULL,0) == 0
! #endif
! ;
}
static int mode; /* != 0 if we are parsing glob patterns */
--- 36,42 ----
{
char *us = unmeta(s);
! return access(us,0) == 0 || readlink(us,NULL,0) == 0;
}
static int mode; /* != 0 if we are parsing glob patterns */
diff -rc ../a-3.0.5/Src/hashtable.c ./Src/hashtable.c
*** ../a-3.0.5/Src/hashtable.c Mon Mar 30 12:07:08 1998
--- ./Src/hashtable.c Tue Dec 17 12:14:11 1996
***************
*** 1152,1158 ****
void
fillnameddirtable(HashTable ht)
{
- #ifndef NO_GETPWENT
if (!allusersadded) {
struct passwd *pw;
--- 1152,1157 ----
***************
*** 1166,1172 ****
endpwent();
allusersadded = 1;
}
- #endif
return;
}
--- 1165,1170 ----
diff -rc ../a-3.0.5/Src/params.c ./Src/params.c
*** ../a-3.0.5/Src/params.c Mon Mar 30 11:26:29 1998
--- ./Src/params.c Thu Sep 25 18:42:17 1997
***************
*** 1702,1715 ****
homesetfn(Param pm, char *x)
{
zsfree(home);
! #ifndef NO_SYMLINKS
! if ( x
! && isset(CHASELINKS)
! && (home = xsymlink(x))
! )
zsfree(x);
else
- #endif
home = x ? x : ztrdup("");
finddir(NULL);
}
--- 1702,1710 ----
homesetfn(Param pm, char *x)
{
zsfree(home);
! if (x && isset(CHASELINKS) && (home = xsymlink(x)))
zsfree(x);
else
home = x ? x : ztrdup("");
finddir(NULL);
}
diff -rc ../a-3.0.5/Src/system.h ./Src/system.h
*** ../a-3.0.5/Src/system.h Mon Mar 30 12:33:51 1998
--- ./Src/system.h Mon Jun 02 22:11:28 1997
***************
*** 268,276 ****
#endif
#ifdef HAVE_UTMPX_H
# define STRUCT_UTMP struct utmpx
# define ut_time ut_xtime
- # include <utmpx.h>
#else
# include <utmp.h>
# define STRUCT_UTMP struct utmp
--- 268,276 ----
#endif
#ifdef HAVE_UTMPX_H
+ # include <utmpx.h>
# define STRUCT_UTMP struct utmpx
# define ut_time ut_xtime
#else
# include <utmp.h>
# define STRUCT_UTMP struct utmp
***************
*** 474,482 ****
#if MUST_DEFINE_OSPEED
extern char PC, *BC, *UP;
extern short ospeed;
- #endif
-
- #ifndef S_ISLNK
- # define S_ISLNK(x) 0 /* false - DY */
#endif
--- 474,478 ----
diff -rc ../a-3.0.5/Src/utils.c ./Src/utils.c
*** ../a-3.0.5/Src/utils.c Mon Mar 30 12:08:46 1998
--- ./Src/utils.c Thu Sep 25 18:42:18 1997
***************
*** 315,328 ****
*p = '\0';
continue;
}
- #ifndef NO_SYMLINKS
if (unset(CHASELINKS)) {
- #endif
strcat(xbuf, "/");
strcat(xbuf, *pp);
zsfree(*pp);
continue;
- #ifndef NO_SYMLINKS
}
sprintf(xbuf2, "%s/%s", xbuf, *pp);
t0 = readlink(unmeta(xbuf2), xbuf3, PATH_MAX);
--- 315,325 ----
***************
*** 340,346 ****
return 1;
zsfree(*pp);
}
- #endif
}
free(opp);
return 0;
--- 337,342 ----
***************
*** 352,360 ****
char *
xsymlink(char *s)
{
- #ifndef NO_SYMLINKS
if (unset(CHASELINKS))
- #endif
return ztrdup(s);
if (*s != '/')
return NULL;
--- 348,354 ----
diff -rc ../a-3.0.5/Src/watch.c ./Src/watch.c
*** ../a-3.0.5/Src/watch.c Mon Mar 30 10:45:43 1998
--- ./Src/watch.c Fri Jun 28 06:43:51 1996
***************
*** 47,57 ****
int srchlimit = 50; /* max number of wtmp records to search */
if (inout)
- #ifdef XTV
- return u->ut_tv.tv_sec;
- #else
return u->ut_time;
- #endif
if (!(in = fopen(WTMP_FILE, "r")))
return time(NULL);
fseek(in, 0, 2);
--- 47,53 ----
***************
*** 65,75 ****
fclose(in);
return time(NULL);
}
- #ifdef XTV
- if (uu.ut_tv.tv_sec < lastwatch || !srchlimit--) {
- #else
if (uu.ut_time < lastwatch || !srchlimit--) {
- #endif
fclose(in);
return time(NULL);
}
--- 61,67 ----
***************
*** 83,93 ****
}
while (strncmp(uu.ut_line, u->ut_line, sizeof(u->ut_line)));
fclose(in);
! #ifdef XTV
! return uu.ut_tv.tv_sec;
! #else
! return uu.ut_tiime;
! #endif
}
/* Mutually recursive call to handle ternaries in $WATCHFMT */
--- 75,81 ----
}
while (strncmp(uu.ut_line, u->ut_line, sizeof(u->ut_line)));
fclose(in);
! return uu.ut_time;
}
/* Mutually recursive call to handle ternaries in $WATCHFMT */
***************
*** 346,362 ****
int
ucmp(STRUCT_UTMP *u, STRUCT_UTMP *v)
{
- #ifdef XTV
- if (u->ut_tv.tv_sec == v->ut_tv.tv_sec)
- #else
if (u->ut_time == v->ut_time)
- #endif
return strncmp(u->ut_line, v->ut_line, sizeof(u->ut_line));
- #ifdef XTV
- return u->ut_tv.tv_sec - v->ut_tv.tv_sec;
- #else
return u->ut_time - v->ut_time;
- #endif
}
/* initialize the user List */
--- 334,342 ----
diff -rc ../a-3.0.5/Src/zle_main.c ./Src/zle_main.c
*** ../a-3.0.5/Src/zle_main.c Mon Mar 30 11:12:43 1998
--- ./Src/zle_main.c Thu Sep 25 18:42:19 1997
***************
*** 94,101 ****
| FLUSHO
# endif
);
! # ifdef SGTABTYPE
! ti.tio.c_oflag &= ~SGTABTYPE;
# endif
ti.tio.c_oflag |= ONLCR;
ti.tio.c_cc[VQUIT] =
--- 94,107 ----
| FLUSHO
# endif
);
! # ifdef TAB3
! ti.tio.c_oflag &= ~TAB3;
! # else
! # ifdef OXTABS
! ti.tio.c_oflag &= ~OXTABS;
! # else
! ti.tio.c_oflag &= ~XTABS;
! # endif
# endif
ti.tio.c_oflag |= ONLCR;
ti.tio.c_cc[VQUIT] =
***************
*** 150,158 ****
*/
#else /* not HAS_TIO */
! # ifdef SGTABTYPE
! ti.sgttyb.sg_flags = (ti.sgttyb.sg_flags | CBREAK) & ~ECHO & ~SGTABTYPE;
! # endif
ti.lmodes &= ~LFLUSHO;
eofchar = ti.tchars.t_eofc;
ti.tchars.t_quitc =
--- 156,162 ----
*/
#else /* not HAS_TIO */
! ti.sgttyb.sg_flags = (ti.sgttyb.sg_flags | CBREAK) & ~ECHO & ~XTABS;
ti.lmodes &= ~LFLUSHO;
eofchar = ti.tchars.t_eofc;
ti.tchars.t_quitc =
diff -rc ../a-3.0.5/Src/zle_refresh.c ./Src/zle_refresh.c
*** ../a-3.0.5/Src/zle_refresh.c Mon Mar 30 11:17:06 1998
--- ./Src/zle_refresh.c Thu Sep 25 18:42:19 1997
***************
*** 194,203 ****
hasam; /* terminal should have auto-margin */
static int put_rpmpt, /* whether we should display right-prompt */
oput_rpmpt, /* whether displayed right-prompt last time */
-
- #ifdef SGTABTYPE
oxtabs, /* oxtabs - tabs expand to spaces if set */
- #endif
numscrolls, onumscrolls;
extern int clearflag; /* set to non-zero if alwayslastprompt used */
--- 194,200 ----
***************
*** 231,239 ****
/* Nov 96: <mason> I haven't checked how complete this is. sgtty stuff may
or may not work */
- #ifdef SGTABTYPE
oxtabs = ((SGTTYFLAG & SGTABTYPE) == SGTABTYPE);
- #endif
cleareol = 0; /* unset */
more_start = more_end = 0; /* unset */
--- 228,234 ----
***************
*** 862,868 ****
}
/* try tabs if tabs are non destructive and multright is not possible */
- #ifdef SGTABTYPE
if (!oxtabs && tccan(TCNEXTTAB) && ((vcs | 7) < cl)) {
i = (vcs | 7) + 1;
tcout(TCNEXTTAB);
--- 857,862 ----
***************
*** 871,877 ****
if ((ct = cl - i) == 0) /* number of chars still to move across */
return;
}
- #endif
/* otherwise _carefully_ write the contents of the video buffer.
if we're anywhere in the prompt, goto the left column and write the whole
--- 865,870 ----
diff -rc ../a-3.0.5/Src/zsh.h ./Src/zsh.h
*** ../a-3.0.5/Src/zsh.h Mon Mar 30 11:08:19 1998
--- ./Src/zsh.h Thu Sep 25 18:42:20 1997
***************
*** 1209,1217 ****
# ifdef OXTABS
#define SGTABTYPE OXTABS
# else
- # ifdef XTABS
#define SGTABTYPE XTABS
- # endif
# endif
# endif
--- 1209,1215 ----
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: zsh on u/win on NT?
1998-08-06 16:34 ` Dave Yost
@ 1998-08-06 16:41 ` Zefram
0 siblings, 0 replies; 6+ messages in thread
From: Zefram @ 1998-08-06 16:41 UTC (permalink / raw)
To: Dave Yost; +Cc: zsh-workers
Dave Yost wrote:
>Well it's been a while since I last tried, so I'll have to go back and get back into it. Anyway, here are some changes I made to get 4.0.5 to compile. It would be great if someone would roll these changes or their equivalent into the current development version. Then maybe I should start fresh with that.
Some of these issues have already been addressed (such as dependence on
symlinks). I'll produce patches for the rest. In a couple of versions
time, I'd like to have zsh not relying on any non-POSIX functionality
in the OS.
-zefram
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1998-08-06 17:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-04 19:55 Feature Request: HIST_STORE_BANG option Matt Gerassimoff
1998-08-05 19:08 ` Bart Schaefer
1998-08-05 20:19 ` zsh on u/win on NT? Dave Yost
1998-08-06 8:44 ` Zefram
1998-08-06 16:34 ` Dave Yost
1998-08-06 16:41 ` Zefram
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).