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

Re: [PATCH] enable elaped time with incappendhistory



On Mon, 07 Oct 2013 11:32:52 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> I'll commit this immediately to remove the pathology, but
> there may be more tweaks.

This is a somewhat non-standard setting, but we probably need to
continue to allow SHAREHISTORY to override INCAPPENDHISTORY: it always
did but now we need a separate test for the new case.

pws


diff --git a/Src/hist.c b/Src/hist.c
index c58ce8b..d1af30a 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -928,7 +928,15 @@ hbegin(int dohist)
 	histactive = HA_ACTIVE | HA_NOINC;
 
     hf = getsparam("HISTFILE");
-    if (isset(INCAPPENDHISTORY) && !(histactive & HA_NOINC) && !strin)
+    /*
+     * For INCAPPENDHISTORY, when interactive, save the history here
+     * as it gives a better estimate of the times of commands.
+     * If SHAREHISTORY is also set continue to do so in the
+     * standard place, because that's safer about reading and
+     * rewriting history atomically.
+     */
+    if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) &&
+	!(histactive & HA_NOINC) && !strin)
 	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
 }
 



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