zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: History and precmd
@ 2000-03-19  7:28 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2000-03-19  7:28 UTC (permalink / raw)
  To: zsh-workers

Does anybody know of a problem with the following?  I suddenly found myself
wanting the history number for `print -P %h` and the value of the $history
assoc to be up-to-date during precmd().

I used stophist = 3 because it wasn't being used for anything else.  If
there's some reason that all current values of stophist are powers of 2,
I couldn't discover it.

Index: Src/init.c
===================================================================
@@ -106,12 +106,16 @@
     for (;;) {
 	freeheap();
 	errflag = 0;
+	hbegin(1);		/* init history mech        */
 	if (isset(SHINSTDIN)) {
 	    setblock_stdin();
-	    if (interact)
+	    if (interact) {
+	        int hstop = stophist;
+		stophist = 3;
 		preprompt();
+		stophist = hstop;
+	    }
 	}
-	hbegin(1);		/* init history mech        */
 	intr();			/* interrupts on            */
 	lexinit();              /* initialize lexical state */
 	if (!(prog = parse_event())) {	/* if we couldn't parse a list */

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-03-19  7:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-19  7:28 PATCH: History and precmd 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).