From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2484 invoked by alias); 20 Oct 2011 17:03:43 -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: 29833 Received: (qmail 4423 invoked from network); 20 Oct 2011 17:03:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at klanderman.net does not designate permitted sender hosts) From: Greg Klanderman To: zsh-workers@zsh.org Subject: Re: reading/saving history file dependent on isset(RCS) Reply-To: gak@klanderman.net Date: Thu, 20 Oct 2011 12:55:12 -0400 In-Reply-To: <111020001018.ZM9637@torch.brasslantern.com> (Bart Schaefer's message of "Thu, 20 Oct 2011 00:10:17 -0700") Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.17 (linux) References: <20127.6190.501587.50858@gargle.gargle.HOWL> <111020001018.ZM9637@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>>>> On October 20, 2011 Bart Schaefer wrote: > There isn't a default setting for HISTFILE, so if no startup files are > read there's no way for the shell to know what history file to read. > That's not "conditioned on" the option, it's just a side-effect. But it's not just a side-effect; the call to readhistfile() is actually conditioned on 'isset(RCS)', so if my .zshenv sets HISTFILE and also 'setopt norcs', it does not read my HISTFILE. Based on there being no default setting for HISTFILE, can the isset(RCS) check can be safely removed for the readhistfile() call? > I'm pretty sure that the reasoning is that if the shell didn't read the > history file in the first place (which it could not possibly have, see > above) then it's likely to destroy information if it writes the file > on exit. So the user has to deliberately clear the option if he wants > the shell to behave like one that started up with the option off. Likewise, if there is no default setting of HISTFILE, can we safely remove the isset(RCS) checks for the savehistfile() calls? It seems useful to consider two cases: 1. NORCS gets set from the command line (zsh -f): in this case HISTFILE is not set, and the isset(RCS) checks are superfluous. 2. NORCS gets set from some startup file, to inhibit later startup files from loading: in this case, if you've set HISTFILE, it seems reasonable to honor it for both reading and writing the history. The argument about not clobbering a file that was not read in the first place only holds if the shell brokenly decided not to read the file that was requested via the user having set HISTFILE. Greg