zsh-workers
 help / color / mirror / code / Atom feed
* unsetopt banghist does not work.
@ 1999-07-30  7:58 Tanaka Akira
  1999-07-30  8:46 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Tanaka Akira @ 1999-07-30  7:58 UTC (permalink / raw)
  To: zsh-workers

I found a problem about banghist.

Z(2):akr@is27e1u11% zsh-3.1.6-test-3 -f
is27e1u11% unsetopt banghist
is27e1u11% echo !!
echo unsetopt banghist
unsetopt banghist
is27e1u11% 

pws-21 works well, but pws-22 has same behaviour to test-3.
-- 
Tanaka Akira


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

* Re: unsetopt banghist does not work.
  1999-07-30  7:58 unsetopt banghist does not work Tanaka Akira
@ 1999-07-30  8:46 ` Peter Stephenson
  1999-07-30 10:44   ` Tanaka Akira
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 1999-07-30  8:46 UTC (permalink / raw)
  To: zsh-workers

Tanaka Akira wrote:
> I found a problem about banghist.
> 
> Z(2):akr@is27e1u11% zsh-3.1.6-test-3 -f
> is27e1u11% unsetopt banghist
> is27e1u11% echo !!
> echo unsetopt banghist
> unsetopt banghist
> is27e1u11% 
> 
> pws-21 works well, but pws-22 has same behaviour to test-3.

I searched for BANGHIST in the archive, but I couldn't find the relevant
change, the last one is 6542, but there must be one later --- is it
working?

The following ought to work (the first hunk is just because the logic
confused me), but could everybody please try this on the favourite mode of
history usage.  Judging by the fact that it's been there for weeks, nobody
uses nobanghist anyway.

This had better be the last major bug.

I suppose I'm going to be told the following is just how history is
supposed to work?

  % unsetopt banghist
  % echo !!
  !!
  % setopt banghist
  % !!
  zsh: no such word in event

(it recovers after that).

--- Src/hist.c~	Mon Jul 19 17:43:17 1999
+++ Src/hist.c	Fri Jul 30 10:27:17 1999
@@ -700,7 +700,7 @@
 {
     isfirstln = isfirstch = 1;
     errflag = histdone = spaceflag = 0;
-    stophist = (dohist ? ((!interact || unset(SHINSTDIN)) << 1) : 2);
+    stophist = (!dohist || !interact || unset(SHINSTDIN)) ? 2 : 0;
     if (stophist == 2 || (inbufflags & INP_ALIAS)) {
 	chline = hptr = NULL;
 	hlinesz = 0;
@@ -721,6 +721,8 @@
 	hwbegin = ihwbegin;
 	hwend = ihwend;
 	addtoline = iaddtoline;
+	if (!isset(BANGHIST))
+	    stophist = 2;
     }
     chwordpos = 0;
 

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* Re: unsetopt banghist does not work.
  1999-07-30  8:46 ` Peter Stephenson
@ 1999-07-30 10:44   ` Tanaka Akira
  1999-07-31  4:41     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Tanaka Akira @ 1999-07-30 10:44 UTC (permalink / raw)
  To: zsh-workers

In article <9907300846.AA31025@ibmth.df.unipi.it>,
  Peter Stephenson <pws@ibmth.df.unipi.it> writes:

> The following ought to work (the first hunk is just because the logic
> confused me), but could everybody please try this on the favourite mode of
> history usage.  Judging by the fact that it's been there for weeks, nobody
> uses nobanghist anyway.

Usually, I use nobanghist. :-)
But it is very rare case to use ! for a argument...

> I suppose I'm going to be told the following is just how history is
> supposed to work?
> 
>   % unsetopt banghist
>   % echo !!
>   !!
>   % setopt banghist
>   % !!
>   zsh: no such word in event

This behaviour is different to zsh-3.1.5-pws-21 and zsh-3.1.5.

Z(2):akr@is27e1u11% zsh-3.1.5-pws-21 -f
is27e1u11% unsetopt banghist
is27e1u11% echo !!
!!
is27e1u11% setopt banghist
is27e1u11% !!
setopt banghist
is27e1u11% 
-- 
Tanaka Akira


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

* Re: unsetopt banghist does not work.
  1999-07-30 10:44   ` Tanaka Akira
@ 1999-07-31  4:41     ` Bart Schaefer
  1999-07-31  4:47       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1999-07-31  4:41 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

On Jul 30,  7:44pm, Tanaka Akira wrote:
} Subject: Re: unsetopt banghist does not work.
}
} In article <9907300846.AA31025@ibmth.df.unipi.it>,
}   Peter Stephenson <pws@ibmth.df.unipi.it> writes:
} > I suppose I'm going to be told the following is just how history is
} > supposed to work?
} > 
} >   % unsetopt banghist
} >   % echo !!
} >   !!
} >   % setopt banghist
} >   % !!
} >   zsh: no such word in event
} 
} This behaviour is different to zsh-3.1.5-pws-21 and zsh-3.1.5.

The problem is with this change:

  Sven: 6542, 6551: Don't buffer in the history code any text that won't
  be added to the history.

This was done to speed up sourcing of files and execution of functions, but
it has the side-effect of causing the history to be discarded completely
when NOBANGHIST is in effect; or at least it has that effect when combined
with PWS's patch of 7324.  Obviously this is unacceptable -- it means that
"unsetopt banghist" also disables the zle history operations.

I think the following is the right fix.  It goes on top of 7324.  There
probably ought to be some #define constants for this instead of numbers.

Index: Src/hist.c
===================================================================
@@ -722,7 +722,7 @@
 	hwend = ihwend;
 	addtoline = iaddtoline;
 	if (!isset(BANGHIST))
-	    stophist = 2;
+	    stophist = 4;
     }
     chwordpos = 0;
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: unsetopt banghist does not work.
  1999-07-31  4:41     ` Bart Schaefer
@ 1999-07-31  4:47       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1999-07-31  4:47 UTC (permalink / raw)
  To: zsh-workers

On Jul 31,  4:41am, Bart Schaefer wrote:
} Subject: Re: unsetopt banghist does not work.
[...]
} with PWS's patch of 7324.  Obviously this is unacceptable -- it means that
[...]
} I think the following is the right fix.  It goes on top of 7324.

Of course I meant 7321 in both of those places.  Sigh.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1999-07-31  4:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-30  7:58 unsetopt banghist does not work Tanaka Akira
1999-07-30  8:46 ` Peter Stephenson
1999-07-30 10:44   ` Tanaka Akira
1999-07-31  4:41     ` Bart Schaefer
1999-07-31  4:47       ` Bart Schaefer

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).