Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] enable elaped time with incappendhistory



Hello,

Could you please reveiw this patch? Thanks in advance.



If incappendhistory being set, the command line will be written before
it has finished. So elaped time doesn't work. Looks like this patch
lets it working again. And sharehistory will still cause the command
line written before it has finished.
---
 Src/hist.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/Src/hist.c b/Src/hist.c
index f78c97d..33a8357 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 */
     /*
-- 
1.7.7.6



Messages sorted by: Reverse Date, Date, Thread, Author