From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24919 invoked from network); 13 Feb 1997 23:07:59 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 13 Feb 1997 23:07:59 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id RAA29567; Thu, 13 Feb 1997 17:50:19 -0500 (EST) Resent-Date: Thu, 13 Feb 1997 17:22:12 -0500 (EST) From: "Bart Schaefer" Message-Id: <970213142920.ZM22919@candle.brasslantern.com> Date: Thu, 13 Feb 1997 14:29:20 -0800 Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-users@math.gatech.edu Subject: How to make APPENDHISTORY useful? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"mnddS3.0.jy6.KGv0p"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/675 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu `APPEND_HISTORY' If this is set, zsh sessions will append their history list to the history file, rather than overwrite it. Thus, multiple parallel zsh sessions will all have their history lists added to the history file, in the order they are killed. This sounds useful, but in practice it's not very helpful. Here's why: Suppose I set HISTSIZE to be more lines than SAVEHIST. Now every time a shell exits, it appends its history to the file and then truncates the file to SAVEHIST lines. Result: Same as if history weren't appended. Now suppose I set SAVEHIST to be more lines than HISTSIZE. Every time a shell exits, it appends its history to the file, leaving some lines from other shells at the top. So far so good. But when I start a new shell, it reads in all that history and then truncates it to HISTSIZE. Result: Same as if history hadn't been appended. You get the illusion that something good is happening if you start with an empty file and run a few shells that don't put SAVEHIST lines into the history before exiting; but once the file gets full you're back to one of the states described above. A logical thought would be to start out with HISTSIZE set to at least as large as SAVEHIST, and then just before saving the history file, reset HISTSIZE to something less than SAVEHIST, so that the tail end of this shell's history would mix with whatever is already in the file. But that doesn't work because the history file is written *before* the exit traps execute and before zlogout files are read, so there's no place to put the re-assignment to HISTSIZE. To get the *effect* of reducing HISTSIZE before saving, you have to put a bunch of `fc' commands in your exit trap or zlogout. But if you have to do that anyway, then you can *explicitly* append, so APPEND_HISTORY is of no benefit in that case. What am I missing here?