zsh-workers
 help / color / mirror / code / Atom feed
From: Greg Klanderman <gak@klanderman.net>
To: zsh-workers@zsh.org
Subject: Re: reading/saving history file dependent on isset(RCS)
Date: Thu, 20 Oct 2011 12:55:12 -0400	[thread overview]
Message-ID: <m3botb8uxb.fsf@klanderman.net> (raw)
In-Reply-To: <111020001018.ZM9637@torch.brasslantern.com> (Bart Schaefer's message of "Thu, 20 Oct 2011 00:10:17 -0700")


>>>>> On October 20, 2011 Bart Schaefer <schaefer@brasslantern.com> 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


  reply	other threads:[~2011-10-20 17:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 18:34 Greg Klanderman
2011-10-19 18:48 ` Benjamin R. Haskell
2011-10-20  7:10   ` Bart Schaefer
2011-10-20 16:55     ` Greg Klanderman [this message]
2011-10-21 12:40       ` Bart Schaefer
2011-10-21 15:26         ` Greg Klanderman
2011-10-24 17:08           ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3botb8uxb.fsf@klanderman.net \
    --to=gak@klanderman.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).