about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHan Pingtian <hanpt@linux.vnet.ibm.com>2013-10-05 20:50:10 +0800
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-10-05 22:03:43 +0100
commit16ff79a885f28bc9509901dd5d8ce9ccc9960811 (patch)
tree7d0af424123a7434921d2740e76d3860a3250c85
parent75fdec17b1ed7e4b3ede4b995003175b885d5f6d (diff)
downloadzsh-16ff79a885f28bc9509901dd5d8ce9ccc9960811.tar.gz
zsh-16ff79a885f28bc9509901dd5d8ce9ccc9960811.tar.xz
zsh-16ff79a885f28bc9509901dd5d8ce9ccc9960811.zip
31789: Save history for INCAPPENDHISTORY later.
This improves the timing recorded in the history.
-rw-r--r--ChangeLog5
-rw-r--r--Src/hist.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bd37e0a2d..1cf815eee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-05  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Hang Pingtian: 31789: Src/hist.c: add history for
+	INCAPPENDHISTORY later so history time works.
+
 2013-10-03  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 31784: Src/Zle/computil.c: when deciding whether there is enough
diff --git a/Src/hist.c b/Src/hist.c
index 3d6068e51..1961d8350 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -871,6 +871,8 @@ unlinkcurline(void)
 mod_export void
 hbegin(int dohist)
 {
+    char *hf;
+
     isfirstln = isfirstch = 1;
     errflag = histdone = 0;
     if (!dohist)
@@ -924,6 +926,10 @@ hbegin(int dohist)
 	defev = addhistnum(curhist, -1, HIST_FOREIGN);
     } else
 	histactive = HA_ACTIVE | HA_NOINC;
+
+    hf = getsparam("HISTFILE");
+    if (isset(INCAPPENDHISTORY))
+	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
 }
 
 /**/
@@ -1328,7 +1334,7 @@ hend(Eprog prog)
     chline = hptr = NULL;
     chwords = NULL;
     histactive = 0;
-    if (isset(SHAREHISTORY)? histfileIsLocked() : isset(INCAPPENDHISTORY))
+    if (isset(SHAREHISTORY) && histfileIsLocked())
 	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
     unlockhistfile(hf); /* It's OK to call this even if we aren't locked */
     /*