From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22551 invoked by alias); 5 Oct 2013 13:00:36 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31789 Received: (qmail 22868 invoked from network); 5 Oct 2013 13:00:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.2 Date: Sat, 5 Oct 2013 20:50:10 +0800 From: Han Pingtian To: zsh-workers@zsh.org Subject: [PATCH] enable elaped time with incappendhistory Message-ID: <20131005125010.GA23376@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13100512-0320-0000-0000-000001409688 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