summaryrefslogtreecommitdiff
path: root/Src/hist.c
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 /Src/hist.c
parent75fdec17b1ed7e4b3ede4b995003175b885d5f6d (diff)
downloadzsh-16ff79a885f28bc9509901dd5d8ce9ccc9960811.tar.gz
zsh-16ff79a885f28bc9509901dd5d8ce9ccc9960811.zip
31789: Save history for INCAPPENDHISTORY later.
This improves the timing recorded in the history.
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c8
1 files changed, 7 insertions, 1 deletions
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 */
/*