zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] enable elaped time with incappendhistory
@ 2013-10-05 12:50 Han Pingtian
  2013-10-05 21:04 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Han Pingtian @ 2013-10-05 12:50 UTC (permalink / raw)
  To: zsh-workers

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


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

end of thread, other threads:[~2013-10-11 10:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-05 12:50 [PATCH] enable elaped time with incappendhistory Han Pingtian
2013-10-05 21:04 ` Peter Stephenson
2013-10-07 10:32   ` Peter Stephenson
2013-10-07 10:56     ` Peter Stephenson
2013-10-10 17:30       ` Peter Stephenson
2013-10-11 10:05         ` Peter Stephenson
2013-10-11 10:34           ` Peter Stephenson

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